The following code causes an ICE when compiled with the current gcc trunk at -Os and above on x86_64-linux-gnu in both 32-bit and 64-bit modes. It is a regression from 4.9.x. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 5.0.0 20150103 (experimental) [trunk revision 219158] (GCC) $ $ gcc-trunk -O1 -c small.c $ gcc-4.9 -Os -c small.c $ $ gcc-trunk -Os -c small.c small.c:26:1: internal compiler error: in compute_inlined_call_time, at ipa-inline.c:550 } ^ 0x110a06d compute_inlined_call_time(cgraph_edge*, int) ../../gcc-trunk/gcc/ipa-inline.c:550 0x11003b1 big_speedup_p ../../gcc-trunk/gcc/ipa-inline.c:561 0x1104cb6 want_inline_small_function_p ../../gcc-trunk/gcc/ipa-inline.c:613 0x1107623 inline_small_functions ../../gcc-trunk/gcc/ipa-inline.c:1640 0x1107623 ipa_inline ../../gcc-trunk/gcc/ipa-inline.c:2185 0x1107623 execute ../../gcc-trunk/gcc/ipa-inline.c:2558 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. $ ---------------------------- int a, b, c, d; void fn1 (int p) { b = ~c; for (;;) ; } static int fn2 (int p) { if (p) d = 0; if (!p) fn1 (0); return a; } void fn3 () { a = 0; fn2 (a); }
The following (somewhat simpler) test case triggers the same ICE: --------------------- int a, b, c; int fn1 () { return a || b; } static void fn2 (int p) { if (p) c = fn1 (); for (;;) ; } void fn3 () { fn2 (1); }
It is caused by r219076.
This is caused by fact that we calculate times in fixed point, but compensate them later in sreal. The patch https://gcc.gnu.org/ml/gcc-patches/2015-01/msg00004.html ought to solve the issue.
Seems to be fixed.