https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64485

            Bug ID: 64485
           Summary: ICE at -Os and above on x86_64-linux-gnu in
                    compute_inlined_call_time, at ipa-inline.c:550
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

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);
}

Reply via email to