llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.37k stars 12.14k forks source link

blocks and templates: non-canonical or dependent type in IR-generation #18519

Open llvmbot opened 10 years ago

llvmbot commented 10 years ago
Bugzilla Link 18145
Version trunk
OS Linux
Attachments preprocessed source
Reporter LLVM Bugzilla Contributor

Extended Description

$ clang -c test.cpp -fblocks -std=c++11 non-canonical or dependent type in IR-generation UNREACHABLE executed at /home/ian/llvm2/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:95! 0 clang 0x00000000035fe4be llvm::sys::PrintStackTrace(_IO_FILE) + 46 1 clang 0x00000000035fe77b 2 clang 0x00000000035fe9ee 3 libpthread.so.0 0x00007f4717f6e030 4 libc.so.6 0x00007f4716e33475 gsignal + 53 5 libc.so.6 0x00007f4716e366f0 abort + 384 6 clang 0x00000000035e6416 7 clang 0x0000000000c45617 clang::CodeGen::CodeGenFunction::getEvaluationKind(clang::QualType) + 119 8 clang 0x0000000000c29f6d 9 clang 0x0000000000d6ee44 clang::CodeGen::CodeGenFunction::EmitAggExpr(clang::Expr const, clang::CodeGen::AggValueSlot) + 68 10 clang 0x0000000000d3d204 clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const, clang::ValueDecl const, clang::CodeGen::LValue, bool) + 1076 11 clang 0x0000000000d3bf80 clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) + 784 12 clang 0x0000000000d39ae5 clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&) + 53 13 clang 0x0000000000d3973e clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) + 270 14 clang 0x0000000000d394d2 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) + 386 15 clang 0x0000000000c25a85 clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) + 117 16 clang 0x0000000000c20f25 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const) + 325 17 clang 0x0000000000c207d7 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const) + 87 18 clang 0x0000000000c2635b clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) + 139 19 clang 0x0000000000c4880b clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&, clang::Stmt const) + 107 20 clang 0x0000000000c48d7d clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function, clang::CodeGen::CGFunctionInfo const&) + 1357 21 clang 0x0000000000c5cf28 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl) + 920 22 clang 0x0000000000c5a28f clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 511 23 clang 0x0000000000c5c20c clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) + 764 24 clang 0x0000000000c5e665 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl) + 245 25 clang 0x0000000000bc6860 26 clang 0x0000000000bc4e28 27 clang 0x0000000000e3270c clang::ParseAST(clang::Sema&, bool, bool) + 524 28 clang 0x00000000008f9989 clang::ASTFrontendAction::ExecuteAction() + 345 29 clang 0x0000000000bc456e clang::CodeGenAction::ExecuteAction() + 1246 30 clang 0x00000000008f94af clang::FrontendAction::Execute() + 191 31 clang 0x00000000008c4350 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 800 32 clang 0x00000000008861c8 clang::ExecuteCompilerInvocation(clang::CompilerInstance) + 1048 33 clang 0x0000000000873e8a cc1_main(char const, char const, char const, void) + 698 34 clang 0x00000000008802c2 main + 802 35 libc.so.6 0x00007f4716e1fead __libc_start_main + 253 36 clang 0x0000000000873ae9 Stack dump:

  1. Program arguments: /home/ian/llvm2/build/Debug+Asserts/bin/clang -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name test.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.22 -coverage-file /home/ian/tmp/q/test.o -resource-dir /home/ian/llvm2/build/Debug+Asserts/bin/../lib/clang/3.5 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/x86_64-linux-gnu -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backward -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7 -internal-isystem /usr/local/include -internal-isystem /home/ian/llvm2/build/Debug+Asserts/bin/../lib/clang/3.5/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 /home/ian/tmp/q -ferror-limit 19 -fmessage-length 199 -mstackrealign -fblocks -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o test.o -x c++ test.cpp
  2. parser at end of file
  3. test.cpp:16:5: LLVM IR generation of declaration 'main'
  4. test.cpp:16:5: Generating code for declaration 'main' clang: error: unable to execute command: Aborted clang: error: clang frontend command failed due to signal (use -v to see invocation) clang version 3.5 (trunk 196387) Target: x86_64-unknown-linux-gnu Thread model: posix clang: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang: note: diagnostic msg:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang: note: diagnostic msg: /tmp/test-6b798d.cpp clang: note: diagnostic msg: /tmp/test-6b798d.sh clang: note: diagnostic msg:


$

The run script contains:

"/home/ian/llvm2/build/Debug+Asserts/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name test.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.22 -std=c++11 -fdeprecated-macro -ferror-limit 19 -fmessage-length 199 -mstackrealign -fblocks -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -x c++ test-6b798d.cpp

Endilll commented 1 year ago

Still crashing as of post-17 trunk: https://godbolt.org/z/YW7E68n1Y

clang++: /root/llvm-project/clang/lib/AST/Expr.cpp:3302:
bool clang::Expr::isConstantInitializer(clang::ASTContext&, bool, const clang::Expr**) const:
Assertion `!isValueDependent() && "Expression evaluator can't be called on a dependent expression."' 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.  Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -std=c++11 -fblocks <source>
1.  <eof> parser at end of file
2.  <source>:15:5: LLVM IR generation of declaration 'main'
3.  <source>:15:5: Generating code for declaration 'main'
 #0 0x0000000003678548 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3678548)
 #1 0x00000000036763cc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x36763cc)
 #2 0x00000000035c3c28 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f4a31dd7420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f4a3189a00b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
 #5 0x00007f4a31879859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
 #6 0x00007f4a31879729 (/lib/x86_64-linux-gnu/libc.so.6+0x22729)
 #7 0x00007f4a3188afd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x0000000006e84809 clang::Expr::isConstantInitializer(clang::ASTContext&, bool, clang::Expr const**) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x6e84809)
 #9 0x0000000003d42435 clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(clang::VarDecl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d42435)
#10 0x0000000003d42b23 clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (.part.0) CGDecl.cpp:0:0
#11 0x0000000003d42dd0 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3d42dd0)
#12 0x00000000039820a7 clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x39820a7)
#13 0x0000000003995ed7 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3995ed7)
#14 0x000000000398f325 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x398f325)
#15 0x000000000399580c clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x399580c)
#16 0x00000000039f2fe6 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x39f2fe6)
#17 0x0000000003a060da clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a060da)
#18 0x0000000003a6775d clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a6775d)
#19 0x0000000003a628f5 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a628f5)
#20 0x0000000003a62eb3 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3a62eb3)
#21 0x0000000003a6c0a3 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#22 0x00000000048d3636 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#23 0x00000000048c5dd8 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48c5dd8)
#24 0x0000000005d905f4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x5d905f4)
#25 0x00000000048d06a8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x48d06a8)
#26 0x0000000004138c59 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4138c59)
#27 0x00000000040bcfee clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x40bcfee)
#28 0x0000000004219096 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x4219096)
#29 0x0000000000bcd462 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbcd462)
#30 0x0000000000bc5c4a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#31 0x0000000003f1d239 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#32 0x00000000035c40d4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x35c40d4)
#33 0x0000000003f1d82f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#34 0x0000000003ee5795 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ee5795)
#35 0x0000000003ee61fd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3ee61fd)
#36 0x0000000003eedd25 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x3eedd25)
#37 0x0000000000bcb717 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbcb717)
#38 0x0000000000ac5481 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xac5481)
#39 0x00007f4a3187b083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#40 0x0000000000bc572e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0xbc572e)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-codegen