Skip to content

Constant::signExtend crash LLVM-13 on M1 Monterey #22

Open
@ganler

Description

I am developing a new pass using LLVM-13 from Homebrew and I got a strange bug that whenever I call Constant::signExtend the pass crashes with opt invoked. However, when I use Linux x64 (also LLVM-14) it is not an issue. I did not find any recent commit on LLVM's Constant::signExtend so I guess it is either related to Homebrew or M1?

To reproduce this bug:

git clone [email protected]:ganler/mini-kint.git
mkdir -p mini-kint/build
cd mini-kint/build
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
cmake .. -DLLVM_DIR=/opt/homebrew/opt/llvm/lib/cmake/llvm -DCMAKE_CXX_COMPILER=$(which clang++) -DCMAKE_C_COMPILER=$(which clang) -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -DCMAKE_BUILD_TYPE=Debug

make -j8

Create a file a.c

#include <stdint.h>

size_t __mkint_ann_malloc_array_nc(uint8_t n, uint8_t size) { return n * size; }
clang -O0 -Xclang -disable-O0-optnone -emit-llvm -S a.c
opt -load-pass-plugin=mkint/MiniKintPass.dylib -passes=mkint-pass -S a.ll
# crash

image

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions