Skip to content

CSI allocfn compiler crash #267

Description

@DanielDeLayo

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)

  1. git clone -b opencilk/v2.1 https://github.com/OpenCilk/infrastructure and infrastructure/tools/get $(pwd)/opencilk

  2. 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)

  3. Build with infrastructure/tools/build $(pwd)/opencilk $(pwd)/build

  4. write minimal example to strdup.cpp

#include <cilk/cilk.h>
#include <string.h>

int main()
{
        strdup("a");
        return 0;
}
  1. Compile with build/bin/clang++ -fcilktool=cilkscale -fopencilk strdup.cpp

  2. Compiler crashes
    (.txt added to filenames so github will allow them to be attached)
    out.txt
    strdup-43bc7f.cpp.txt
    strdup-43bc7f.sh.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions