[llvm-bugs] [Bug 42126] New: clang crashes when compiling code

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 4 16:09:51 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42126

            Bug ID: 42126
           Summary: clang crashes when compiling code
           Product: clang
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

My clang is 7.0.0. The command line is:

clang++ -gsplit-dwarf -Wno-incompatible-library-redeclaration

The code is:

 struct A;
 struct Iter { A& operator*(); void operator++(); };
 bool operator!=(Iter, Iter);
 struct { Iter begin(); Iter end(); } seq;
 void f() { for (auto& [left, right] : seq); }


The error message:
     decomposition declarations are a C++17 extension [-Wc++17-extensions]
 void f() { for (auto& [left, right] : seq); }
                       ^~~~~~~~~~~~~
clang-7: /usr/local/lib/llvm7.0/tools/clang/include/clang/AST/DeclCXX.h:669:
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-7 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
code0.c.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -enable-split-dwarf
-debug-info-kind=limited -debugger-tuning=gdb -split-dwarf-file code0.dwo
-resource-dir /usr/local/lib/clang/7.0.0 -internal-isystem
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../include/c++/9.0.0
-internal-isystem
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../include/c++/9.0.0/x86_64-pc-linux-gnu
-internal-isystem
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.0.0/../../../../include/c++/9.0.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/lib/clang/7.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Wno-incompatible-library-redeclaration
-fdeprecated-macro -fdebug-compilation-dir /home/haozhong -ferror-limit 19
-fmessage-length 80 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/code0-9b15c0.o -x c++
/home/haozhong/project/approach/compilerpara/llvm/tmp/llvm_39148/code0.c.cpp 
1.     
/home/haozhong/project/approach/compilerpara/llvm/tmp/llvm_39148/code0.c.cpp:5:44:
current parser token ';'
2.     
/home/haozhong/project/approach/compilerpara/llvm/tmp/llvm_39148/code0.c.cpp:5:11:
parsing function body 'f'
3.     
/home/haozhong/project/approach/compilerpara/llvm/tmp/llvm_39148/code0.c.cpp:5:11:
in compound statement ('{}')
#0 0x00005625624afcb9 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/usr/local/lib/llvm7.0/lib/Support/Unix/Signals.inc:490:0
#1 0x00005625624afd4c PrintStackTraceSignalHandler(void*)
/usr/local/lib/llvm7.0/lib/Support/Unix/Signals.inc:554:0
#2 0x00005625624adad6 llvm::sys::RunSignalHandlers()
/usr/local/lib/llvm7.0/lib/Support/Signals.cpp:67:0
#3 0x00005625624af6dc SignalHandler(int)
/usr/local/lib/llvm7.0/lib/Support/Unix/Signals.inc:353:0
#4 0x00007fca28d22890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#5 0x00007fca27e1ae97 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x3ee97)
#6 0x00007fca27e1c801 abort (/lib/x86_64-linux-gnu/libc.so.6+0x40801)
#7 0x00007fca27e0c39a (/lib/x86_64-linux-gnu/libc.so.6+0x3039a)
#8 0x00007fca27e0c412 (/lib/x86_64-linux-gnu/libc.so.6+0x30412)
#9 0x000056256276d19c clang::CXXRecordDecl::data() const
/usr/local/lib/llvm7.0/tools/clang/include/clang/AST/DeclCXX.h:670:0
#10 0x0000562564fe72a0 clang::CXXRecordDecl::hasDirectFields() const
/usr/local/lib/llvm7.0/tools/clang/include/clang/AST/DeclCXX.h:1333:0
#11 0x0000562564f4e893 findDecomposableBaseClass(clang::Sema&,
clang::SourceLocation, clang::CXXRecordDecl const*,
llvm::SmallVector<clang::CXXBaseSpecifier*, 4u>&)
/usr/local/lib/llvm7.0/tools/clang/lib/Sema/SemaDeclCXX.cpp:1228:0
#12 0x0000562564f4f22b checkMemberDecomposition(clang::Sema&,
llvm::ArrayRef<clang::BindingDecl*>, clang::ValueDecl*, clang::QualType,
clang::CXXRecordDecl const*)
/usr/local/lib/llvm7.0/tools/clang/lib/Sema/SemaDeclCXX.cpp:1303:0
#13 0x0000562564f4fe27
clang::Sema::CheckCompleteDecompositionDeclaration(clang::DecompositionDecl*)
/usr/local/lib/llvm7.0/tools/clang/lib/Sema/SemaDeclCXX.cpp:1456:0
#14 0x0000562564d8f9f2
clang::Sema::CheckCompleteVariableDeclaration(clang::VarDecl*)
/usr/local/lib/llvm7.0/tools/clang/lib/Sema/SemaDecl.cpp:11476:0
#15 0x0000562564d8dc53 clang::Sema::AddInitializerToDecl(clang::Decl*,
clang::Expr*, bool)
/usr/local/lib/llvm7.0/tools/clang/lib/Sema/SemaDecl.cpp:10996:0
#16 0x00005625653d7946 clang::Sema::BuildCXXForRangeStmt(clang::SourceLocation,
clang::SourceLocation, clang::SourceLocation, clang::Stmt*, clang::Stmt*,
clang::Stmt*, clang::Expr*, clang::Expr*, clang::Stmt*, clang::SourceLocation,
clang::Sema::BuildForRangeKind)
/usr/local/lib/llvm7.0/tools/clang/lib/Sema/SemaStmt.cpp:2580:0
#17 0x00005625653d5456 clang::Sema::ActOnCXXForRangeStmt(clang::Scope*,
clang::SourceLocation, clang::SourceLocation, clang::Stmt*,
clang::SourceLocation, clang::Expr*, clang::SourceLocation,
clang::Sema::BuildForRangeKind)
/usr/local/lib/llvm7.0/tools/clang/lib/Sema/SemaStmt.cpp:2121:0
#18 0x0000562564926b6c clang::Parser::ParseForStatement(clang::SourceLocation*)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/ParseStmt.cpp:1766:0
#19 0x00005625649211ed
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/ParseStmt.cpp:251:0
#20 0x0000562564920aab
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/ParseStmt.cpp:111:0
#21 0x0000562564923e64 clang::Parser::ParseCompoundStatementBody(bool)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/ParseStmt.cpp:1001:0
#22 0x0000562564927815 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/ParseStmt.cpp:1974:0
#23 0x000056256485e062
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/Parser.cpp:1243:0
#24 0x0000562564883000 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/ParseDecl.cpp:1952:0
#25 0x000056256485cff1
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/Parser.cpp:1013:0
#26 0x000056256485d0cb
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/Parser.cpp:1028:0
#27 0x000056256485c68a
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/Parser.cpp:853:0
#28 0x000056256485b927
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/Parser.cpp:610:0
#29 0x0000562564857617 clang::ParseAST(clang::Sema&, bool, bool)
/usr/local/lib/llvm7.0/tools/clang/lib/Parse/ParseAST.cpp:157:0
#30 0x0000562562f0dc21 clang::ASTFrontendAction::ExecuteAction()
/usr/local/lib/llvm7.0/tools/clang/lib/Frontend/FrontendAction.cpp:1011:0
#31 0x0000562563437864 clang::CodeGenAction::ExecuteAction()
/usr/local/lib/llvm7.0/tools/clang/lib/CodeGen/CodeGenAction.cpp:1044:0
#32 0x0000562562f0d634 clang::FrontendAction::Execute()
/usr/local/lib/llvm7.0/tools/clang/lib/Frontend/FrontendAction.cpp:914:0
#33 0x0000562562e9b6b2
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/usr/local/lib/llvm7.0/tools/clang/lib/Frontend/CompilerInstance.cpp:962:0
#34 0x0000562563070610
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/usr/local/lib/llvm7.0/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:257:0
#35 0x000056255ffd831a cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) /usr/local/lib/llvm7.0/tools/clang/tools/driver/cc1_main.cpp:216:0
#36 0x000056255ffcdb00 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef)
/usr/local/lib/llvm7.0/tools/clang/tools/driver/driver.cpp:310:0
#37 0x000056255ffce7d5 main
/usr/local/lib/llvm7.0/tools/clang/tools/driver/driver.cpp:382:0
#38 0x00007fca27dfdb97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#39 0x000056255ffcb13a _start (/usr/local/bin/clang-7+0x1e9513a)
clang-7: error: unable to execute command: Aborted (core dumped)
clang-7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (trunk 337118)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-7: 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-7: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-7: note: diagnostic msg: /tmp/code0-f121da.cpp
clang-7: note: diagnostic msg: /tmp/code0-f121da.sh
clang-7: 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/20190604/c3873274/attachment-0001.html>


More information about the llvm-bugs mailing list