Describe the bug
Enabling allocfn instrumentation using CSI when the code contains strdup causes a compiler crash.
We use cilkscale for a minimal example, but the crash is reproducible on custom tools.
We reproduce the crash with strdup because other allocfns, such as malloc, do not cause a crash but are not instrumented.
Expected behavior
The code to be compiled successfully and strdup and malloc to be instrumented by CSI
OpenCilk version
Built from source:
opencilk-project: df80b7d
cheetah: 5a80d8a534e8d56a5e354997bbfea23257c1c36b
productivity-tools: 4493af865e411dd9288c1af40d3358543281e0d2
infrastructure: release ee22572e020e96b0ae1d05c046c201281ee713e3
System information
- OS: Rocky Linux 9.4 (Blue Onyx)
- CPU: AMD EPYC 7643 48-Core Processor
- (Running on a node of SBU's seawulf cluster)
Steps to reproduce (include relevant output)
-
git clone -b opencilk/v2.1 https://github.com/OpenCilk/infrastructure and infrastructure/tools/get $(pwd)/opencilk
-
Comment out opencilk/clang/lib/CodeGen/BackendUtil.cpp line 281
That is, comment out Options.InstrumentAllocFns = false; in the function static CSIOptions getCSIOptionsForCilkscale(bool InstrumentBasicBlocks)
-
Build with infrastructure/tools/build $(pwd)/opencilk $(pwd)/build
-
write minimal example to strdup.cpp
#include <cilk/cilk.h>
#include <string.h>
int main()
{
strdup("a");
return 0;
}
-
Compile with build/bin/clang++ -fcilktool=cilkscale -fopencilk strdup.cpp
-
Compiler crashes
(.txt added to filenames so github will allow them to be attached)
out.txt
strdup-43bc7f.cpp.txt
strdup-43bc7f.sh.txt
Describe the bug
Enabling allocfn instrumentation using CSI when the code contains strdup causes a compiler crash.
We use cilkscale for a minimal example, but the crash is reproducible on custom tools.
We reproduce the crash with strdup because other allocfns, such as malloc, do not cause a crash but are not instrumented.
Expected behavior
The code to be compiled successfully and strdup and malloc to be instrumented by CSI
OpenCilk version
Built from source:
opencilk-project: df80b7dcheetah: 5a80d8a534e8d56a5e354997bbfea23257c1c36bproductivity-tools: 4493af865e411dd9288c1af40d3358543281e0d2infrastructure:releaseee22572e020e96b0ae1d05c046c201281ee713e3System information
Steps to reproduce (include relevant output)
git clone -b opencilk/v2.1 https://github.com/OpenCilk/infrastructureandinfrastructure/tools/get $(pwd)/opencilkComment out
opencilk/clang/lib/CodeGen/BackendUtil.cppline 281That is, comment out
Options.InstrumentAllocFns = false;in the functionstatic CSIOptions getCSIOptionsForCilkscale(bool InstrumentBasicBlocks)Build with
infrastructure/tools/build $(pwd)/opencilk $(pwd)/buildwrite minimal example to
strdup.cppCompile with
build/bin/clang++ -fcilktool=cilkscale -fopencilk strdup.cppCompiler crashes
(.txt added to filenames so github will allow them to be attached)
out.txt
strdup-43bc7f.cpp.txt
strdup-43bc7f.sh.txt