llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.12k stars 12.01k forks source link

Unlimited recursion in clang makes the machine unusable. #108716

Open Abramo-Bagnara opened 2 months ago

Abramo-Bagnara commented 2 months ago

I've restricted the testcase to the tiny source below that is still able to make clang consume all the memory and make the machine unusable. I've stopped the run for this reason.

abramo@hp:~/bugs$ cat bug1.cc
struct c {
  c &a = *new c;
  c() {}
} aobj;
abramo@hp:~/bugs$ clang++-18 -c bug1.cc 
bug1.cc:2:11: warning: stack nearly exhausted; compilation time may suffer, and crashes due to stack overflow are likely [-Wstack-exhausted]
    2 |   c &a = *new c;
      |           ^
^C
shafik commented 2 months ago

Looks like this started w/ clang-16: https://godbolt.org/z/4Gfqq8q3K