https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87087
Bug ID: 87087 Summary: Optimization hangs up and consumes over 15Gb of memory Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: konstantin.vladimirov at gmail dot com Target Milestone: --- Reproduction (after creduce, sorry for that code): b; d; e() { unsigned f; unsigned g; int h; long i = 901380; for (;;) { d = 0; for (; d; d++) { h = 50126706678236; f = 0; for (; f < 15; f += 3) { g = 0; for (; g < 9; g++) b = h = i - (h << 5) + h; } } i = 0; } } Compiler: > gcc -v Reading specs from /apps/gcc/8.1.0/.bin/../lib64/gcc/x86_64-suse-linux/8.1.0/specs COLLECT_GCC=/apps/gcc/8.1.0/.bin/gcc COLLECT_LTO_WRAPPER=/apps/gcc/8.1.0/.bin/../libexec/gcc/x86_64-suse-linux/8.1.0/lto-wrapper Target: x86_64-suse-linux Configured with: ./configure --prefix=/apps/gcc/8.1.0 --libdir=/apps/gcc/8.1.0/lib64 --libexecdir=/apps/gcc/8.1.0/libexec --bindir=/apps/gcc/8.1.0/bin --with-isl=/apps/gcc/8.1.0 --with-libelf=/apps/gcc/8.1.0 --with-mpfr=/apps/gcc/8.1.0 --with-gmp=/apps/gcc/8.1.0 --with-mpc=/apps/gcc/8.1.0 --disable-gnu-unique-object --enable-gold=yes --enable-lto --enable-languages=c,c++,objc,fortran --build=x86_64-suse-linux --host=x86_64-suse-linux --target=x86_64-suse-linux --enable-libotm --disable-multilib --disable-bootstrap --disable-libstdcxx-pch Thread model: posix gcc version 8.1.0 (GCC) Try to compile like this: > gcc -O3 test.c You will see compiler hanging up and eating all of memory. > gcc -O2 test.c This passes ok.