-
Notifications
You must be signed in to change notification settings - Fork 38
Description
When I specify -fsanitize=undefined,cilk I get a crash from
clang-10: /home/neboat/opencilk/llvm/include/llvm/Support/Casting.h:264: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = llvm::Instruction, Y = llvm::User]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
either of them alone does not cause a crash.
just using -fsanitize=undefined leads to an error of
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
error: Cannot represent a difference across sections
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
which I don't know if it is expected.
The code in question does compile fine when I disable cilk.
if I just use -fsanitize=cilk
The code has a linker error of undefined reference to `__csan_setvbuf' which I assume is the same as #47
The command that triggers the error is
../OpenCilk-10.0.1-Linux/bin/clang++ -Wall -Wno-address-of-packed-member -Wextra -O3 -g -std=c++17 -fopencilk -fsanitize=undefined,cilk -DNUM_RAW_BLOCKS=1 -DNUM_DENSE_BLOCKS=512 -DOPENMP=0 -DCILK=1 test.cpp -lrt -lm -lm -ldl -o basic
The full output is
In file included from ./SparseMatrix.cpp:3:
In file included from ./helpers.h:4:
./parallel.h:25:10: warning: '__cilkrts_get_worker_number' is deprecated [-Wdeprecated-declarations]
return __cilkrts_get_worker_number();
^
/home/ubuntu/OpenCilk-10.0.1-Linux/lib/clang/10.0.1/include/cilk/cilk_api.h:11:66: note: '__cilkrts_get_worker_number' has been explicitly marked deprecated here
extern unsigned __cilkrts_get_worker_number(void) attribute((deprecated));
^
clang-10: /home/neboat/opencilk/llvm/include/llvm/Support/Casting.h:264: typename cast_retty<X, Y *>::ret_type llvm::cast(Y *) [X = llvm::Instruction, Y = llvm::User]: Assertion `isa(Val) && "cast() argument of incompatible type!"' failed.
Stack dump:
0. Program arguments: /home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name test.cpp -mrelocation-model static -mthread-model posix -mframe-pointer=none -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -resource-dir /home/ubuntu/OpenCilk-10.0.1-Linux/lib/clang/10.0.1 -D NUM_RAW_BLOCKS=1 -D NUM_DENSE_BLOCKS=512 -D OPENMP=0 -D CILK=1 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/backward -internal-isystem /usr/local/include -internal-isystem /home/ubuntu/OpenCilk-10.0.1-Linux/lib/clang/10.0.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -Wno-address-of-packed-member -Wextra -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/ubuntu/SSTGraph_public -ferror-limit 19 -fmessage-length 0 -fopencilk -mllvm -use-opencilk-runtime-bc=true -mllvm -opencilk-runtime-bc-path=/home/ubuntu/OpenCilk-10.0.1-Linux/lib/clang/10.0.1/lib/x86_64-unknown-linux-gnu/libopencilk-abi.bc -fsanitize=cilk,alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,object-size,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound,vptr -fsanitize-recover=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,object-size,pointer-overflow,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,vla-bound,vptr -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -stripmine-loops -faddrsig -o /tmp/test-e5b871.o -x c++ test.cpp
-
<eof> parser at end of file -
Per-module optimization passes -
Running pass 'CilkSanitizer' on module 'test.cpp'. -
Running pass 'Tapir Race Detection' on function '@_Z2BCRK13SparseMatrixVRKjb'
#0 0x0000000004813454 PrintStackTraceSignalHandler(void*) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4813454)
#1 0x00000000048110fe llvm::sys::RunSignalHandlers() (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x48110fe)
#2 0x0000000004813865 SignalHandler(int) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4813865)
#3 0x00007fc0b234b3c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x153c0)
#4 0x00007fc0b084018b raise /build/glibc-eX1tMB/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007fc0b081f859 abort /build/glibc-eX1tMB/glibc-2.31/stdlib/abort.c:81:7
#6 0x00007fc0b081f729 get_sysdep_segment_value /build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:509:8
#7 0x00007fc0b081f729 _nl_load_domain /build/glibc-eX1tMB/glibc-2.31/intl/loadmsgcat.c:970:34
#8 0x00007fc0b0830f36 (/lib/x86_64-linux-gnu/libc.so.6+0x36f36)
#9 0x0000000003a4da62 (anonymous namespace)::CapturesBefore::shouldExplore(llvm::Use const*) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x3a4da62)
#10 0x0000000003a4d6cd llvm::PointerMayBeCaptured(llvm::Value const*, llvm::CaptureTracker*, unsigned int)::$_0::operator()(llvm::Value const*) const (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x3a4d6cd)
#11 0x0000000003a4cc9d llvm::PointerMayBeCaptured(llvm::Value const*, llvm::CaptureTracker*, unsigned int) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x3a4cc9d)
#12 0x0000000003a4d561 llvm::PointerMayBeCapturedBefore(llvm::Value const*, bool, bool, llvm::Instruction const*, llvm::DominatorTree const*, bool, llvm::OrderedBasicBlock*, unsigned int) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x3a4d561)
#13 0x0000000004a75baf (anonymous namespace)::AccessPtrAnalysis::PointerCapturedBefore(llvm::Value const*, llvm::Instruction const*, unsigned int) const (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a75baf)
#14 0x0000000004a72316 (anonymous namespace)::AccessPtrAnalysis::evaluateMaybeParallelAccesses(llvm::GeneralAccess&, llvm::GeneralAccess&, llvm::RaceInfo::ResultTy&, llvm::DenseMap<llvm::Value const*, llvm::ModRefInfo, llvm::DenseMapInfo<llvm::Value const*>, llvm::detail::DenseMapPair<llvm::Value const*, llvm::ModRefInfo> >&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a72316)
#15 0x0000000004a70ae6 (anonymous namespace)::AccessPtrAnalysis::checkForRacesHelper(llvm::Task const*, llvm::RaceInfo::ResultTy&, llvm::DenseMap<llvm::Value const*, llvm::ModRefInfo, llvm::DenseMapInfo<llvm::Value const*>, llvm::detail::DenseMapPair<llvm::Value const*, llvm::ModRefInfo> >&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a70ae6)
#16 0x0000000004a70c76 (anonymous namespace)::AccessPtrAnalysis::checkForRacesHelper(llvm::Task const*, llvm::RaceInfo::ResultTy&, llvm::DenseMap<llvm::Value const*, llvm::ModRefInfo, llvm::DenseMapInfo<llvm::Value const*>, llvm::detail::DenseMapPair<llvm::Value const*, llvm::ModRefInfo> >&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a70c76)
#17 0x0000000004a6b6a7 (anonymous namespace)::AccessPtrAnalysis::processAccessPtrs(llvm::RaceInfo::ResultTy&, llvm::DenseMap<llvm::Value const*, llvm::ModRefInfo, llvm::DenseMapInfo<llvm::Value const*>, llvm::detail::DenseMapPair<llvm::Value const*, llvm::ModRefInfo> >&, llvm::DenseMap<llvm::Loop*, std::unique_ptr<llvm::RuntimePointerChecking, std::default_deletellvm::RuntimePointerChecking >, llvm::DenseMapInfollvm::Loop*, llvm::detail::DenseMapPair<llvm::Loop*, std::unique_ptr<llvm::RuntimePointerChecking, std::default_deletellvm::RuntimePointerChecking > > >&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a6b6a7)
#18 0x0000000004a670b1 llvm::RaceInfo::analyzeFunction() (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a670b1)
#19 0x0000000004a646ed llvm::TapirRaceDetectWrapperPass::runOnFunction(llvm::Function&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a646ed)
#20 0x000000000412fabc llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x412fabc)
#21 0x000000000412f119 llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x412f119)
#22 0x00000000041337b1 non-virtual thunk to (anonymous namespace)::MPPassManager::getOnTheFlyPass(llvm::Pass*, void const*, llvm::Function&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x41337b1)
#23 0x0000000004a28ecc llvm::DominatorTree& llvm::function_ref<llvm::DominatorTree& (llvm::Function&)>::callback_fn<(anonymous namespace)::CilkSanitizerLegacyPass::runOnModule(llvm::Module&)::$_7>(long, llvm::Function&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a28ecc)
#24 0x0000000004a25a55 (anonymous namespace)::CilkSanitizerImpl::setup() (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a25a55)
#25 0x0000000004a28dc8 (anonymous namespace)::CilkSanitizerLegacyPass::runOnModule(llvm::Module&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a28dc8)
#26 0x00000000041304a0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x41304a0)
#27 0x0000000004a0ea6b clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_deletellvm::raw_pwrite_stream >) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x4a0ea6b)
#28 0x000000000519da15 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x519da15)
#29 0x0000000005fb74a3 clang::ParseAST(clang::Sema&, bool, bool) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x5fb74a3)
#30 0x00000000050ebd40 clang::FrontendAction::Execute() (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x50ebd40)
#31 0x0000000005048ad3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x5048ad3)
#32 0x0000000005198130 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x5198130)
#33 0x0000000002b7e21d cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x2b7e21d)
#34 0x0000000002b7c1ec ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x2b7c1ec)
#35 0x0000000002b7bebb main (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x2b7bebb)
#36 0x00007fc0b08210b3 __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
#37 0x0000000002b78fce _start (/home/ubuntu/OpenCilk-10.0.1-Linux/bin/clang-10+0x2b78fce)
clang-10: error: unable to execute command: Aborted (core dumped)
clang-10: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 10.0.1 ([email protected]:OpenCilk/opencilk-project.git 8435006)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/ubuntu/SSTGraph_public/../OpenCilk-10.0.1-Linux/bin
clang-10: note: diagnostic msg: PLEASE submit a bug report to https://github.com/OpenCilk/opencilk-project/issues and include the crash backtrace, preprocessed source, and associated run script.
clang-10: note: diagnostic msg:
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-10: note: diagnostic msg: /tmp/test-5c15bd.cpp
clang-10: note: diagnostic msg: /tmp/test-5c15bd.sh
clang-10: note: diagnostic msg: