OpenCilk / opencilk-project

Monorepo for the OpenCilk compiler. Forked from llvm/llvm-project and based on Tapir/LLVM.
Other
93 stars 29 forks source link

Crash in trivial non-sensical function #194

Closed wheatman closed 9 months ago

wheatman commented 1 year ago

Describe the bug

The following code causes a crash

#include <cilk/cilk.h>

int main() { cilk_spawn return 0; }

Expected behavior

no crash and some sort of error

OpenCilk version

clang version 16.0.6 (https://github.com/OpenCilk/opencilk-project aa4f4c0c6a59a9e42c3ef8cc8ef715f5ed8b7553) and clang version 14.0.6 (https://github.com/OpenCilk/opencilk-project f54e98722992462e042f0686c74f710277c92cdb)

Crash outputs

The crash is different depending on the different flags given The simple crash

compile with no flags ~/opencilk16/build/bin/clang++ del.cpp

get

Unexpected return or resume in task
  ret i32 %1
in function main
fatal error: error in backend: Broken function found, compilation aborted!
clang-16: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 16.0.6 (https://github.com/OpenCilk/opencilk-project aa4f4c0c6a59a9e42c3ef8cc8ef715f5ed8b7553)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wheatman/opencilk16/build/bin
clang-16: note: diagnostic msg: 
********************

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

********************

The longer crash file compile with -fopencilk ~/opencilk16/build/bin/clang++ -fopencilk del.cpp

get

clang-16: /home/wheatman/opencilk16/llvm/include/llvm/IR/DataLayout.h:677: llvm::TypeSize llvm::DataLayout::getTypeSizeInBits(llvm::Type *) const: Assertion `Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"' failed.
PLEASE submit a bug report to https://github.com/OpenCilk/opencilk-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /home/wheatman/opencilk16/build/bin/clang-16 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -clear-ast-before-backend -main-file-name del.cpp -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -mllvm -treat-scalable-fixed-error-as-warning -debugger-tuning=gdb -fcoverage-compilation-dir=/home/wheatman -resource-dir /home/wheatman/opencilk16/build/lib/clang/16 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/x86_64-linux-gnu/c++/11 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/backward -internal-isystem /home/wheatman/opencilk16/build/lib/clang/16/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir=/home/wheatman -ferror-limit 19 -fopencilk --opencilk-abi-bitcode=/home/wheatman/opencilk16/build/lib/clang/16/lib/x86_64-unknown-linux-gnu/libopencilk-abi.bc -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fcolor-diagnostics -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/del-f90109.o -x c++ del.cpp
1.      <eof> parser at end of file
2.      Optimizer
 #0 0x000055801f307c47 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/wheatman/opencilk16/build/bin/clang-16+0x25cac47)
 #1 0x000055801f305afe llvm::sys::RunSignalHandlers() (/home/wheatman/opencilk16/build/bin/clang-16+0x25c8afe)
 #2 0x000055801f30843a SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f0c6c745520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f0c6c799a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007f0c6c799a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007f0c6c799a7c pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x00007f0c6c745476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007f0c6c72b7f3 abort ./stdlib/abort.c:81:7
 #9 0x00007f0c6c72b71b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x00007f0c6c73ce96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x000055801dd082d2 llvm::DataLayout::getTypeSizeInBits(llvm::Type*) const (/home/wheatman/opencilk16/build/bin/clang-16+0xfcb2d2)
#12 0x000055801f33e794 void std::__insertion_sort<llvm::Value**, __gnu_cxx::__ops::_Iter_comp_iter<llvm::fixupInputSet(llvm::Function&, llvm::SetVector<llvm::Value*, std::vector<llvm::Value*, std::allocator<llvm::Value*>>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>> const&, llvm::SetVector<llvm::Value*, std::vector<llvm::Value*, std::allocator<llvm::Value*>>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>>&)::$_1>>(llvm::Value**, llvm::Value**, __gnu_cxx::__ops::_Iter_comp_iter<llvm::fixupInputSet(llvm::Function&, llvm::SetVector<llvm::Value*, std::vector<llvm::Value*, std::allocator<llvm::Value*>>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>> const&, llvm::SetVector<llvm::Value*, std::vector<llvm::Value*, std::allocator<llvm::Value*>>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>>&)::$_1>) LoweringUtils.cpp:0:0
#13 0x000055801f33547b llvm::fixupInputSet(llvm::Function&, llvm::SetVector<llvm::Value*, std::vector<llvm::Value*, std::allocator<llvm::Value*>>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>> const&, llvm::SetVector<llvm::Value*, std::vector<llvm::Value*, std::allocator<llvm::Value*>>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>>&) (/home/wheatman/opencilk16/build/bin/clang-16+0x25f847b)
#14 0x000055801f33a846 llvm::outlineTask(llvm::Task*, llvm::SetVector<llvm::Value*, std::vector<llvm::Value*, std::allocator<llvm::Value*>>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>>&, llvm::SmallVectorImpl<llvm::Value*>&, llvm::Module*, llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false>>>&, llvm::TapirTarget::ArgStructMode, llvm::Type*, llvm::ValueMap<llvm::Value const*, llvm::WeakTrackingVH, llvm::ValueMapConfig<llvm::Value const*, llvm::sys::SmartMutex<false>>>&, llvm::OutlineAnalysis&) (/home/wheatman/opencilk16/build/bin/clang-16+0x25fd846)
#15 0x000055801f353576 TapirToTargetImpl::outlineAllTasks(llvm::Function&, llvm::SmallVectorImpl<llvm::Spindle*>&, llvm::OutlineAnalysis&, llvm::TaskInfo&) (/home/wheatman/opencilk16/build/bin/clang-16+0x2616576)
#16 0x000055801f356bf2 TapirToTargetImpl::processFunction(llvm::Function&, llvm::SmallVectorImpl<llvm::Function*>&) (/home/wheatman/opencilk16/build/bin/clang-16+0x2619bf2)
#17 0x000055801f357823 TapirToTargetImpl::run() (/home/wheatman/opencilk16/build/bin/clang-16+0x261a823)
#18 0x000055801f357b20 llvm::TapirToTargetPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/wheatman/opencilk16/build/bin/clang-16+0x261ab20)
#19 0x0000558020565ecd llvm::detail::PassModel<llvm::Module, llvm::TapirToTargetPass, llvm::PreservedAnalyses, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/wheatman/opencilk16/build/bin/clang-16+0x3828ecd)
#20 0x000055801ec5b885 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/home/wheatman/opencilk16/build/bin/clang-16+0x1f1e885)
#21 0x000055801f6e6b96 (anonymous namespace)::EmitAssemblyHelper::RunOptimizationPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) BackendUtil.cpp:0:0
#22 0x000055801f6dde58 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/home/wheatman/opencilk16/build/bin/clang-16+0x29a0e58)
#23 0x00005580204b1889 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/wheatman/opencilk16/build/bin/clang-16+0x3774889)
#24 0x00005580212a96c0 clang::ParseAST(clang::Sema&, bool, bool) (/home/wheatman/opencilk16/build/bin/clang-16+0x456c6c0)
#25 0x000055801fe4ed10 clang::FrontendAction::Execute() (/home/wheatman/opencilk16/build/bin/clang-16+0x3111d10)
#26 0x000055801fdbfdff clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/wheatman/opencilk16/build/bin/clang-16+0x3082dff)
#27 0x000055801ff231c3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/wheatman/opencilk16/build/bin/clang-16+0x31e61c3)
#28 0x000055801dcdd367 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/wheatman/opencilk16/build/bin/clang-16+0xfa0367)
#29 0x000055801dcd9a6b ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#30 0x000055801dcd9426 clang_main(int, char**) (/home/wheatman/opencilk16/build/bin/clang-16+0xf9c426)
#31 0x00007f0c6c72cd90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#32 0x00007f0c6c72ce40 call_init ./csu/../csu/libc-start.c:128:20
#33 0x00007f0c6c72ce40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#34 0x000055801dcd5bf5 _start (/home/wheatman/opencilk16/build/bin/clang-16+0xf98bf5)
clang-16: error: unable to execute command: Aborted
clang-16: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 16.0.6 (https://github.com/OpenCilk/opencilk-project aa4f4c0c6a59a9e42c3ef8cc8ef715f5ed8b7553)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wheatman/opencilk16/build/bin
clang-16: note: diagnostic msg: 
********************

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

********************
neboat commented 9 months ago

This crash is fixed in the latest release.