You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
Thanks for the bug report. I managed to reproduce this bug on my end.
I believe I have a draft change to fix this bug. But the change is fairly substantial, so it might be hard to accommodate as a patch to your OpenCilk compiler.
There's a simpler change you can apply as a patch, but with it, you'll need to use something like function interpositioning to instrument strdup.
Alternatively, depending on what you're doing, you might be able to use Cilksan's instrumentation hooks, which are similar to the Cilkscale/CSI instrumentation hooks. Cilksan implements a fix for instrumenting strdup.
Let me know what you would prefer for a short-term workaround, patch, or fix for this issue.
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
:release
ee22572e020e96b0ae1d05c046c201281ee713e3System information
Steps to reproduce (include relevant output)
git clone -b opencilk/v2.1 https://github.com/OpenCilk/infrastructure
andinfrastructure/tools/get $(pwd)/opencilk
Comment out
opencilk/clang/lib/CodeGen/BackendUtil.cpp
line 281That is, comment out
Options.InstrumentAllocFns = false;
in the functionstatic CSIOptions getCSIOptionsForCilkscale(bool InstrumentBasicBlocks)
Build with
infrastructure/tools/build $(pwd)/opencilk $(pwd)/build
write minimal example to
strdup.cpp
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
The text was updated successfully, but these errors were encountered: