hokein added a comment.

In D140587#4014437 <https://reviews.llvm.org/D140587#4014437>, @shafik wrote:

> Thank you for the fix, can you explain the failure case in more detail and 
> why checking that `RD` is defined is the correct fix.

The `RD->isAggregate()` needs to access the member of `data()`, for the code in 
the testcase, data() is null, we ends up with accessing a nullptr. see the 
stack trace:

  lang: llvm-project/clang/include/clang/AST/DeclCXX.h:448: struct 
DefinitionData &clang::CXXRecordDecl::data() const: Assertion `DD && "queried 
property of class with no definition"' failed.
  PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ 
and include the crash backtrace, preprocessed source, and associated run script.
  Stack dump:
   #0 0x000055bef3cd7ff3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
llvm-project/llvm/lib/Support/Unix/Signals.inc:567:13
   #1 0x000055bef3cd6260 llvm::sys::RunSignalHandlers() 
llvm-project/llvm/lib/Support/Signals.cpp:105:18
   #2 0x000055bef3cd837a SignalHandler(int) 
llvm-project/llvm/lib/Support/Unix/Signals.inc:412:1
   #3 0x00007f024183daa0 (/lib/x86_64-linux-gnu/libc.so.6+0x3daa0)
   #4 0x00007f024188957c __pthread_kill_implementation 
./nptl/pthread_kill.c:44:76
   #5 0x00007f024183da02 gsignal ./signal/../sysdeps/posix/raise.c:27:6
   #6 0x00007f0241828469 abort ./stdlib/abort.c:81:7
   #7 0x00007f0241828395 _nl_load_domain ./intl/loadmsgcat.c:1177:9
   #8 0x00007f0241836ab2 (/lib/x86_64-linux-gnu/libc.so.6+0x36ab2)
   #9 0x000055bef3fd2b78 (./bin/clang+0x38eab78)
  #10 0x000055bef5e78f07 clang::CXXRecordDecl::isAggregate() const 
llvm-project/clang/include/clang/AST/DeclCXX.h:1119:37
  #11 0x000055bef5e78f07 
clang::InitializationSequence::InitializeFrom(clang::Sema&, 
clang::InitializedEntity const&, clang::InitializationKind const&, 
llvm::MutableArrayRef<clang::Expr*>, bool, bool) 
llvm-project/clang/lib/Sema/SemaInit.cpp:6180:15
  #12 0x000055bef5e89a75 clang::InitializedEntity::getKind() const 
llvm-project/clang/include/clang/Sema/Initialization.h:427:39
  #13 0x000055bef5e89a75 clang::InitializedEntity::isParameterKind() const 
llvm-project/clang/include/clang/Sema/Initialization.h:461:13
  #14 0x000055bef5e89a75 
clang::Sema::PerformCopyInitialization(clang::InitializedEntity const&, 
clang::SourceLocation, clang::ActionResult<clang::Expr*, true>, bool, bool) 
llvm-project/clang/lib/Sema/SemaInit.cpp:10253:14
  #15 0x000055bef5ffecd3 
clang::Sema::PerformMoveOrCopyInitialization(clang::InitializedEntity const&, 
clang::Sema::NamedReturnInfo const&, clang::Expr*, bool) /usr/


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140587/new/

https://reviews.llvm.org/D140587

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to