Open merge34 opened 4 years ago
Hi,
The limitation that you have discovered was there since the beginning: -g
does not work with llvm.mix
because I have not added the necessary support for debug metadata.
If I run your example under the Debug build of clang
(and btw I do recommend having the debug build lying around for investigating issues like this), it prints the following message before spitting out the stack dump:
Unhandled metadata kind
UNREACHABLE executed at /path/to/llvm/lib/Transforms/Mix/StagedIRBuilder.h:639!
which points to this line in the source code. The metadata in question is !DILocalVariable
.
I opened the corresponding issue in llvm.mix
repository: eush77/llvm.mix#1
Hello. At the moment I am working on a project about the partial evaluation of CUDA code and I've noticed a possible problem in Clang.Mix. At the beginning I thought it compatibility problem with CUDA, but later I found out that it is much more general.
Scenario
clang -S -O1 -emit-llvm test.c -g
(pay attention to-g
)Problem If we follow the described scenario, we will get
Segmentation fault
error.Example Consider the following minimal code example:
According to LLVM.mix FOSDEM presentation, the code should be valid. But if we compile it with
-g
(aka Debug mode), we will getSegmentation fault
error.Full error message
``` Stack dump: 0. Program arguments: /usr/local/bin/clang-8 -cc1 -triple x86_64-unknown-linux-gnu -S -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file /tmp/tests/llvm_mix_algo/benchmark/test.gcno -resource-dir /usr/local/lib/clang/8.0.0 -internal-isystem /usr/local/include -internal-isystem /usr/local/lib/clang/8.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /tmp/tests/llvm_mix_algo/benchmark -ferror-limit 19 -fmessage-length 238 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o test.s -x c test.c -faddrsig 1.test-ae6a88.c
``` # 1 "test-ae6a88.sh
``` # Crash reproducer for clang version 8.0.0 # Driver args: "-S" "test.c" "-g" # Original command: "/usr/local/bin/clang-8" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-S" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test.c" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu" "x86-64" "-dwarf-column-info" "-debug-info-kind=limited" "-dwarf-version=4" "-debugger-tuning=gdb" "-coverage-notes-file" "/tmp/tests/llvm_mix_algo/benchmark/test.gcno" "-resource-dir" "/usr/local/lib/clang/8.0.0" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/local/lib/clang/8.0.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdebug-compilation-dir" "/tmp/tests/llvm_mix_algo/benchmark" "-ferror-limit" "19" "-fmessage-length" "238" "-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o" "test.s" "-x" "c" "test.c" "-faddrsig" "/usr/local/bin/clang-8" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-S" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "test.c" "-mrelocation-model" "static" "-mthread-model" "posix" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu" "x86-64" "-dwarf-column-info" "-debug-info-kind=limited" "-dwarf-version=4" "-debugger-tuning=gdb" "-coverage-notes-file" "/tmp/tests/llvm_mix_algo/benchmark/test.gcno" "-ferror-limit" "19" "-fmessage-length" "238" "-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-x" "c" "test-ae6a88.c" "-faddrsig" ```Environment description