Open Quuxplusone opened 3 years ago
Forgot to add that I was able to build successfully using clang 11 on an Arch Linux distro. What might differ between Ubuntu and Arch in a way that is relevant here is a mystery.
This is not clang / static analyzer. Moving to new bugs.
Do you get the same crash when emitting LLVM IR without optimisations from clang (clang -S -emit-llvm -mllvm -disable-llvm-optzns) and then running opt -O1/2/3
?
No crash with -S -emit-llvm -mllvm -disable-llvm-optzns
in place of -c
.
clang++ -O1 -c
crashes with the output; clang++ -c
does not.
I can attach the resulting .ll file if that would help.
(In reply to Martin Thomson from comment #4)
No crash with
-S -emit-llvm -mllvm -disable-llvm-optzns
in place of-c
.
clang++ -O1 -c
crashes with the output;clang++ -c
does not.I can attach the resulting .ll file if that would help.
Does running opt -O1
crash with the .ll file? If it does, please attache the file.
If it doesn't, you could try to printing/dumping the IR before the crashing pass (e.g. clang -O1 -mllvm -print-before-all -mllvm -print-module-scope
) and try if the last dump of the module crashes when running opt -pass ...
. (the above produces a lot of output, you can also use -mllvm -print-before=pass-name
if you know the pass name).
Yes, clang++ -O1 -c file.ll
crashes. However, as the file is 40M (!) - and almost 4M compressed - I can't upload it here. Here's a gist: https://gist.github.com/martinthomson/2039aeadfc23612c6b6117f254d35a3a
Now that I see that 520k lines, it's possible that this is just a case of "too bad, too big".
FWIW, while this stresses gcc, it doesn't crash (except when producing aarch64 code, for some reason). gcc is much slower than clang compiling the original source and it uses a staggering 1.5G of RAM to do so, but it manages. It produces an interesting warning at -O1, indicating that there is some inbuilt protection against things getting out of hand: note: variable tracking size limit exceeded with '-fvar-tracking-assignments', retrying without
.
This ultimately crashes for the file that I'm using.
The stack is long, but it starts with:
That last line repeats a few times, until it ends on:
And a few more lines that look to be stable. The height of the stack seems stable.
This might be related to Bug 43249 but I can't tell.
The file that causes this is at https://hg.mozilla.org/projects/nss/file/e78141a928f4b1d98525aacf03043f17e56cac22/gtests/pk11_gtest/pk11_hpke_unittest.cc Building that requires a bit of work (which I'm happy to walk someone through if that is needed). I don't have a shorter repro, sorry.
I'm using the Ubuntu 21.04 distribution with clang version 12. It crashes in earlier versions as well (Ubuntu 20.04 has clang 10; Ubuntu 18.04 with whatever version that has).