This is an archive of the discontinued LLVM Phabricator instance.

[Clang] Fix BZ47169, loader_uninitialized on incomplete types
ClosedPublic

Authored by JonChesterfield on Aug 14 2020, 12:42 PM.

Details

Summary

[Clang] Fix BZ47169, loader_uninitialized on incomplete types

Reported by @erichkeane. Fix proposed by @erichkeane works, tests included.
Bug introduced in D74361. Crash was on querying a CXXRecordDecl for
hasTrivialDefaultConstructor on an incomplete type. Fixed by calling
RequireCompleteType in the right place.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2020, 12:42 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
JonChesterfield requested review of this revision.Aug 14 2020, 12:42 PM
erichkeane added inline comments.Aug 14 2020, 12:46 PM
clang/test/Sema/attr-loader-uninitialized.cpp
14

Should this give the 'cannot be declared 'extern' and with the 'loader_uninitialized' attribute?' error instead? it seems to make more sense there, and is more specific.

clang/test/Sema/attr-loader-uninitialized.cpp
14

It probably should, yes. I'll see whether I can hit that diagnostic instead.

Were you able to make any progress on this?

Were you able to make any progress on this?

No, interrupted by other things. May have some time later today - only need to work out where the suboptimal diagnostic is emitted and see whether it can be cleanly preempted.

  • Use more specific diagnostic
erichkeane accepted this revision.Aug 19 2020, 10:10 AM
This revision is now accepted and ready to land.Aug 19 2020, 10:10 AM

Works out cleanly, thanks for the suggestion.

clang/lib/Sema/SemaDecl.cpp
12478–12489

Same as first diff except for swapping the existing two checks over.

This revision was landed with ongoing or failed builds.Aug 19 2020, 10:12 AM
This revision was automatically updated to reflect the committed changes.
clang/test/CodeGenCXX/attr-loader-uninitialized.cpp
34

This broke 32 bit builds where the pointer is not eight byte aligned. Patched by dropping the align from the filecheck pattern in 3d82c9b6960afe50a76b8c23e9bc42c51d41e767. Credit to Luke Benes for reporting the error, thanks!