Tapir-LLVM
Tapir-LLVM copied to clipboard
Compiler segfault when spawning expression
I recently discovered Tapir's ability to spawn statements, but found a few examples that crash the compiler. Here's one:
#include <cilk/cilk.h>
void demo(long * x, long * y)
{
*y = cilk_spawn x[3];
}
Output (built from source, a recent version of the xla_8 branch):
Stack dump:
0. Program arguments: /home1/ehein6/local/tapir-vanilla/bin/clang-8 -cc1 -triple x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -discard-value-names -main-file-name example.c -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 -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file /tmp/compiler-explorer-compiler120023-1752-1xk7jkz.ehpg/output.gcno -resource-dir /home1/ehein6/local/tapir-vanilla/lib/clang/8.0.1 -internal-isystem /usr/local/include -internal-isystem /home1/ehein6/local/tapir-vanilla/lib/clang/8.0.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /tmp/compiler-explorer-compiler120023-1752-1xk7jkz.ehpg -ferror-limit 19 -fmessage-length 0 -fcilkplus -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -mllvm --x86-asm-syntax=intel -o /tmp/compiler-explorer-compiler120023-1752-1xk7jkz.ehpg/output.s -x c <source> -faddrsig
1. <eof> parser at end of file
2. <source>:3:6: LLVM IR generation of declaration 'demo'
3. <source>:3:6: Generating code for declaration 'demo'
#0 0x000000000223996a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x223996a)
#1 0x00000000022379fa llvm::sys::RunSignalHandlers() (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x22379fa)
#2 0x0000000002237b27 SignalHandler(int) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x2237b27)
#3 0x00007f2ca8c05390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00000000025b2bd4 clang::CodeGen::CodeGenFunction::DetachScope::FinishDetach() (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x25b2bd4)
#5 0x0000000002658fc3 (anonymous namespace)::ScalarExprEmitter::VisitBinAssign(clang::BinaryOperator const*) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x2658fc3)
#6 0x0000000002654613 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x2654613)
#7 0x0000000002656a1d clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x2656a1d)
#8 0x0000000002611c6f clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*, clang::CodeGen::AggValueSlot, bool) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x2611c6f)
#9 0x00000000026224fd clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x26224fd)
#10 0x0000000002464aec clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x2464aec)
#11 0x00000000024650a3 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x24650a3)
#12 0x0000000002499c10 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x2499c10)
#13 0x00000000024a4ce9 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x24a4ce9)
#14 0x00000000024db534 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x24db534)
#15 0x00000000024d96bc clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x24d96bc)
#16 0x00000000024d9cd3 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x24d9cd3)
#17 0x00000000024de777 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.5675.constprop.5680) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x24de777)
#18 0x0000000002cc8543 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x2cc8543)
#19 0x0000000002cbefe2 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x2cbefe2)
#20 0x0000000003566a5e clang::ParseAST(clang::Sema&, bool, bool) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x3566a5e)
#21 0x0000000002cc6091 clang::CodeGenAction::ExecuteAction() (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x2cc6091)
#22 0x00000000028671f6 clang::FrontendAction::Execute() (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x28671f6)
#23 0x00000000028293ce clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x28293ce)
#24 0x00000000029013ec clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x29013ec)
#25 0x0000000000a26408 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0xa26408)
#26 0x00000000009716bf main (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0x9716bf)
#27 0x00007f2ca775a830 __libc_start_main /build/glibc-LK5gWL/glibc-2.23/csu/../csu/libc-start.c:325:0
#28 0x0000000000a23899 _start (/home1/ehein6/local/tapir-vanilla/bin/clang-8+0xa23899)
clang-8: error: unable to execute command: Segmentation fault (core dumped)
clang-8: error: clang frontend command failed due to signal (use -v to see invocation)
Compiler returned: 254