Created attachment 28595 [details] testcase If one compiles the attached testcase with "-02" or higher, cc1plus will quickly run out of memory and eventually be killed by the OOM killer. % g++ -O2 -c exit.ii g++: internal compiler error: Killed (program cc1plus)
Reduced: class Sandbox { void sandbox_exit (); struct A { int write (); }; void die (); }; int a; void Sandbox::sandbox_exit () { A b; while (b.write () && 1) if (a) die (); for (;;); }
This only happens when gcc was lto/profiledbootstraped. Looks like it gets miscompiled in this case.
(In reply to comment #2) > This only happens when gcc was lto/profiledbootstraped. > Looks like it gets miscompiled in this case. Turned out that "--enable-checking=release" is enough to trigger this bug. % ~/gcc/configure --disable-bootstrap --disable-werror --disable-multilib --enable-languages=c,c++ --enable-checking=release % make
Started with r193047: commit 9ccd9ece034984af0e6a775fdfb51b98a7029a84 Author: steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> Date: Wed Oct 31 21:37:10 2012 +0000 gcc/ PR tree-optimization/55018
Gcc is spinning in compute_antic (tree-ssa-pre.c:2507) calling bitmap_set_new() until OOM: #0 _int_malloc (av=0x7ffff794d600 <main_arena>, bytes=2408) at malloc.c:3694 #1 0x00007ffff7661700 in __GI___libc_malloc (bytes=2408) at malloc.c:2859 #2 0x0000000000cbc938 in xmalloc (size=<optimized out>) at /home/markus/gcc/libiberty/xmalloc.c:147 #3 0x000000000060b561 in pool_alloc (pool=0x11a51e0) at /home/markus/gcc/gcc/alloc-pool.c:282 #4 0x0000000000936c00 in bitmap_set_new () at /home/markus/gcc/gcc/tree-ssa-pre.c:606 #5 0x000000000094065c in compute_antic_aux (block_has_abnormal_pred_edge=<optimized out>, block=0x7ffff73d4d00) at /home/markus/gcc/gcc/tree-ssa-pre.c:2161 #6 compute_antic () at /home/markus/gcc/gcc/tree-ssa-pre.c:2507 #7 do_pre () at /home/markus/gcc/gcc/tree-ssa-pre.c:4709
dup *** This bug has been marked as a duplicate of bug 55191 ***