OpenCilk / opencilk-project

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

crash when using `-fsanitize=cilk` without `-fopencilk` #198

Closed wheatman closed 7 months ago

wheatman commented 11 months ago

Describe the bug

The following code causes a crash

//crashes with ~/opencilk16/build/bin/clang++  -fsanitize=cilk  del.cpp
// gives a warning with ~/opencilk16/build/bin/clang++   del.cpp

#include <cilk/cilk.h>

int main() {

  int j = 0;

  cilk_for(int i = 0; i < 10; i++) { j++; }

  return 0;
}

if I compile with with ~/opencilk16/build/bin/clang++ del.cpp I get the expected warning about using cilk without specifying a backend

del.cpp:3:5: warning: CodeGen found Tapir instructions to serialize.  Specify a Tapir back-end to lower Tapir instructions to a parallel runtime. [-Wpass-failed=tapircleanup]
int main() {

However, if I include the flag -fsanitize=cilk then I get the warning followed by a crash

del.cpp:3:5: warning: CodeGen found Tapir instructions to serialize.  Specify a Tapir back-end to lower Tapir instructions to a parallel runtime. [-Wpass-failed=tapircleanup]
int main() {
    ^
fatal error: error in backend: Cannot select: intrinsic %llvm.task.frameaddress
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-5810a1.cpp
clang-16: note: diagnostic msg: /tmp/del-5810a1.sh
clang-16: note: diagnostic msg: 

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

Expected behavior

to just get the warning in both cases

neboat commented 7 months ago

This crash has been fixed in the latest release.