-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
Description
One of our internal tests started to time out and when I looked into it, the test actually appears to be hitting an infinite loop in the compiler. I was able to bisect the cause back to commit 6fd229a. Note that in #109215 it mentions ec78f0d as a possible fix, but I tried that and the compiler still seems to be stuck in an infinite loop.
Consider the following code:
long b;
struct {
unsigned long a : 43;
} c;
void d() {
long e = b & b - 1, f = c.a = e;
c.a = 0;
volatile long g(~f & g);
}If compiled with optimizations and the BMI attributes with a compiler that does not include 6fd229a, the compilation succeeds quickly:
$ time ~/src/upstream/b9cae45b63bc9c44521cc28b4a381afec6181f54-linux/bin/clang -c -O2 -mbmi repro.cpp -o repro.o
real 0m0.046s
user 0m0.012s
sys 0m0.035s
However, the same compilation with a compiler built from ec78f0d still seems to be stuck in an infinite loop somewhere:
$ time /home/dyung/src/upstream/ec78f0da0e9b1b8e2b2323e434ea742e272dd913-linux/bin/clang -c -O2 -mbmi repro.cpp -o repro.o
^C
real 5m6.955s
user 5m6.594s
sys 0m0.337s
Godbolt link: https://godbolt.org/z/7deanqrnn