[llvm-bugs] [Bug 45230] New: clang::CXXRecordDecl crash when variable has incomplete type
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Mar 17 09:28:19 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45230
Bug ID: 45230
Summary: clang::CXXRecordDecl crash when variable has
incomplete type
Product: clang
Version: 10.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: tangyixuan at mail.dlut.edu.cn
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
Hi, clang crashes when compiling the following:
$ cat s.C
union b;
struct S {
template <typename>
void a()
try {
} catch (int ()
noexcept (({ union b c; true; })))
{
}
};
When compiled with g++:
$g++ -std=c++11 s.C
s.C: In member function ‘void S::a()’:
s.C:8:39: error: statement-expression in a constant expression
8 | noexcept (({ union b c; true; })))
| ^
When compiled with clang:
$ clang++ -std=c++11 s.C
s.C:8:28: error: variable has incomplete type 'union b'
noexcept (({ union b c; true; })))
^
s.C:1:7: note: forward declaration of 'b'
union b;
^
clang-9:
/home/oscar/compiler/llvm-project/clang/include/clang/AST/DeclCXX.h:435:
clang::CXXRecordDecl::DefinitionData& clang::CXXRecordDecl::data() const:
Assertion `DD && "queried property of class with no definition"' failed.
Stack dump:
0. Program arguments: /usr/local/bin/clang-9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
s.C -mrelocation-model static -mthread-model posix -mframe-pointer=all
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-resource-dir /usr/local/lib/clang/10.0.0 -internal-isystem
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0
-internal-isystem
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/x86_64-pc-linux-gnu
-internal-isystem
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../include/c++/9.2.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/lib/clang/10.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir
/media/oscar/xuaner1/autogeneration/testsuitC++/compileinformation/gcc10-20191110-crash-testsuit
-ferror-limit 19 -fmessage-length 0 -fgnuc-version=4.2.1 -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-faddrsig -o s.o -x c++ s.C
1. s.C:8:40: current parser token ')'
2. s.C:3:1: parsing struct/union/class body 'S'
3. s.C:6:5: parsing function try block 'S::a'
#0 0x000055dda536405f llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/oscar/compiler/llvm-project/llvm/lib/Support/Unix/Signals.inc:544:0
#1 0x000055dda53640f2 PrintStackTraceSignalHandler(void*)
/home/oscar/compiler/llvm-project/llvm/lib/Support/Unix/Signals.inc:605:0
#2 0x000055dda5361f55 llvm::sys::RunSignalHandlers()
/home/oscar/compiler/llvm-project/llvm/lib/Support/Signals.cpp:68:0
#3 0x000055dda53639ea SignalHandler(int)
/home/oscar/compiler/llvm-project/llvm/lib/Support/Unix/Signals.inc:391:0
#4 0x00007f3fc166e890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#5 0x00007f3fc0766e97 raise (/lib/x86_64-linux-gnu/libc.so.6+0x3ee97)
#6 0x00007f3fc0768801 abort (/lib/x86_64-linux-gnu/libc.so.6+0x40801)
#7 0x00007f3fc075839a (/lib/x86_64-linux-gnu/libc.so.6+0x3039a)
#8 0x00007f3fc0758412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#9 0x000055dda563c6ca clang::CXXRecordDecl::data() const
/home/oscar/compiler/llvm-project/clang/include/clang/AST/DeclCXX.h:436:0
#10 0x000055dda57bbcfa clang::CXXRecordDecl::getNumVBases() const
/home/oscar/compiler/llvm-project/clang/include/clang/AST/DeclCXX.h:604:0
#11 0x000055dda8f71c27 HandleDestructionImpl((anonymous namespace)::EvalInfo&,
clang::SourceLocation, (anonymous namespace)::LValue const&, clang::APValue&,
clang::QualType)
/home/oscar/compiler/llvm-project/clang/lib/AST/ExprConstant.cpp:5796:0
#12 0x000055dda8f726e0 HandleDestruction((anonymous namespace)::EvalInfo&,
clang::SourceLocation, clang::APValue::LValueBase, clang::APValue&,
clang::QualType)
/home/oscar/compiler/llvm-project/clang/lib/AST/ExprConstant.cpp:5948:0
#13 0x000055dda8f5df42 (anonymous namespace)::Cleanup::endLifetime((anonymous
namespace)::EvalInfo&, bool)
/home/oscar/compiler/llvm-project/clang/lib/AST/ExprConstant.cpp:649:0
#14 0x000055dda8fbe2a3 (anonymous
namespace)::ScopeRAII<false>::cleanup((anonymous namespace)::EvalInfo&, bool,
unsigned int)
/home/oscar/compiler/llvm-project/clang/lib/AST/ExprConstant.cpp:1316:0
#15 0x000055dda8f9bdbb (anonymous namespace)::ScopeRAII<false>::destroy(bool)
/home/oscar/compiler/llvm-project/clang/lib/AST/ExprConstant.cpp:1293:0
#16 0x000055dda8fd740e (anonymous namespace)::ExprEvaluatorBase<(anonymous
namespace)::IntExprEvaluator>::VisitStmtExpr(clang::StmtExpr const*)
/home/oscar/compiler/llvm-project/clang/lib/AST/ExprConstant.cpp:7131:0
#17 0x000055dda8fafc67 clang::StmtVisitorBase<llvm::make_const_ptr, (anonymous
namespace)::IntExprEvaluator, bool>::Visit(clang::Stmt const*)
/home/oscar/compiler/llvm-project/build/tools/clang/include/clang/AST/StmtNodes.inc:1277:0
#18 0x000055dda8f91a7a Evaluate(clang::APValue&, (anonymous
namespace)::EvalInfo&, clang::Expr const*)
/home/oscar/compiler/llvm-project/clang/lib/AST/ExprConstant.cpp:13279:0
#19 0x000055dda8f925b3 EvaluateAsRValue((anonymous namespace)::EvalInfo&,
clang::Expr const*, clang::APValue&)
/home/oscar/compiler/llvm-project/clang/lib/AST/ExprConstant.cpp:13395:0
#20 0x000055dda8f929ce EvaluateAsRValue(clang::Expr const*,
clang::Expr::EvalResult&, clang::ASTContext const&, (anonymous
namespace)::EvalInfo&)
/home/oscar/compiler/llvm-project/clang/lib/AST/ExprConstant.cpp:13452:0
#21 0x000055dda8f92c5c clang::Expr::EvaluateAsRValue(clang::Expr::EvalResult&,
clang::ASTContext const&, bool) const
/home/oscar/compiler/llvm-project/clang/lib/AST/ExprConstant.cpp:13497:0
#22 0x000055dda8315569
clang::Sema::VerifyIntegerConstantExpression(clang::Expr*, llvm::APSInt*,
clang::Sema::VerifyICEDiagnoser&, bool)
/home/oscar/compiler/llvm-project/clang/lib/Sema/SemaExpr.cpp:14969:0
#23 0x000055dda8314cf1
clang::Sema::VerifyIntegerConstantExpression(clang::Expr*, llvm::APSInt*,
unsigned int, bool)
/home/oscar/compiler/llvm-project/clang/lib/Sema/SemaExpr.cpp:14872:0
#24 0x000055dda82cbc78 clang::Sema::ActOnNoexceptSpec(clang::SourceLocation,
clang::Expr*, clang::ExceptionSpecificationType&)
/home/oscar/compiler/llvm-project/clang/lib/Sema/SemaExceptionSpec.cpp:92:0
#25 0x000055dda7d67211 clang::Parser::tryParseExceptionSpecification(bool,
clang::SourceRange&, llvm::SmallVectorImpl<clang::OpaquePtr<clang::QualType>
>&, llvm::SmallVectorImpl<clang::SourceRange>&,
clang::ActionResult<clang::Expr*, true>&, llvm::SmallVector<clang::Token,
4u>*&)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3666:0
#26 0x000055dda7d4ae13
clang::Parser::ParseFunctionDeclarator(clang::Declarator&,
clang::ParsedAttributes&, clang::BalancedDelimiterTracker&, bool, bool)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseDecl.cpp:6375:0
#27 0x000055dda7d4a3c6 clang::Parser::ParseParenDeclarator(clang::Declarator&)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseDecl.cpp:6206:0
#28 0x000055dda7d48fbb clang::Parser::ParseDirectDeclarator(clang::Declarator&)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseDecl.cpp:5925:0
#29 0x000055dda7d47a24
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&))
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseDecl.cpp:5583:0
#30 0x000055dda7d47206 clang::Parser::ParseDeclarator(clang::Declarator&)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseDecl.cpp:5451:0
#31 0x000055dda7de865b clang::Parser::ParseCXXCatchBlock(bool)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseStmt.cpp:2307:0
#32 0x000055dda7de834c
clang::Parser::ParseCXXTryBlockCommon(clang::SourceLocation, bool)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseStmt.cpp:2253:0
#33 0x000055dda7de7bcf clang::Parser::ParseFunctionTryBlock(clang::Decl*,
clang::Parser::ParseScope&)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseStmt.cpp:2129:0
#34 0x000055dda7d2df06
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseCXXInlineMethods.cpp:522:0
#35 0x000055dda7d2ca01 clang::Parser::LexedMethod::ParseLexedMethodDefs()
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseCXXInlineMethods.cpp:252:0
#36 0x000055dda7d2dba2
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseCXXInlineMethods.cpp:479:0
#37 0x000055dda7d65b75
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:3362:0
#38 0x000055dda7d60088
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseDeclCXX.cpp:1956:0
#39 0x000055dda7d42360
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseDecl.cpp:3854:0
#40 0x000055dda7d1cf78
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/home/oscar/compiler/llvm-project/clang/lib/Parse/Parser.cpp:1006:0
#41 0x000055dda7d1d59f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/home/oscar/compiler/llvm-project/clang/lib/Parse/Parser.cpp:1111:0
#42 0x000055dda7d1caff
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/home/oscar/compiler/llvm-project/clang/lib/Parse/Parser.cpp:931:0
#43 0x000055dda7d1bd5c
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
/home/oscar/compiler/llvm-project/clang/lib/Parse/Parser.cpp:682:0
#44 0x000055dda7d17b5c clang::ParseAST(clang::Sema&, bool, bool)
/home/oscar/compiler/llvm-project/clang/lib/Parse/ParseAST.cpp:157:0
#45 0x000055dda5de733b clang::ASTFrontendAction::ExecuteAction()
/home/oscar/compiler/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1042:0
#46 0x000055dda6690be2 clang::CodeGenAction::ExecuteAction()
/home/oscar/compiler/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1089:0
#47 0x000055dda5de6c9c clang::FrontendAction::Execute()
/home/oscar/compiler/llvm-project/clang/lib/Frontend/FrontendAction.cpp:939:0
#48 0x000055dda5d7ef17
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/oscar/compiler/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:956:0
#49 0x000055dda5f4ea9b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/oscar/compiler/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:290:0
#50 0x000055dda2a3b0bf cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /home/oscar/compiler/llvm-project/clang/tools/driver/cc1_main.cpp:250:0
#51 0x000055dda2a30613 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef)
/home/oscar/compiler/llvm-project/clang/tools/driver/driver.cpp:309:0
#52 0x000055dda2a30d09 main
/home/oscar/compiler/llvm-project/clang/tools/driver/driver.cpp:382:0
#53 0x00007f3fc0749b97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#54 0x000055dda2a2edea _start (/usr/local/bin/clang-9+0x2b39dea)
clang-9: error: unable to execute command: Aborted (core dumped)
clang-9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 10.0.0 (https://github.com/llvm/llvm-project.git
722b61892454b3217d73ec486e52156c5a92b5b3)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-9: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-9: note: diagnostic msg: /tmp/s-4a4742.cpp
clang-9: note: diagnostic msg: /tmp/s-4a4742.sh
clang-9: note: diagnostic msg:
********************
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200317/583be8ef/attachment-0001.html>
More information about the llvm-bugs
mailing list