Bug 35618 - [4.3 regression] ICE in cgraph_estimate_size_after_inlining, at ipa-inline.c:188
Summary: [4.3 regression] ICE in cgraph_estimate_size_after_inlining, at ipa-inline.c:188
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.3.0
: P2 normal
Target Milestone: 4.4.0
Assignee: Not yet assigned to anyone
Keywords: ice-on-valid-code, monitored
Depends on:
Reported: 2008-03-17 19:10 UTC by Adrian Bunk
Modified: 2011-06-27 11:23 UTC (History)
7 users (show)

See Also:
Known to work: 4.2.3, 4.4.0
Known to fail: 4.3.0
Last reconfirmed: 2008-05-23 14:35:53

preprocessed source (149.49 KB, text/plain)
2008-03-17 19:11 UTC, Adrian Bunk

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Bunk 2008-03-17 19:10:40 UTC
$ gcc -Wp,-MD,kernel/.sched.o.d  -nostdinc -isystem /usr/lib/gcc/i486-linux-gnu/4.3.1/include -D__KERNEL__ -Iinclude -Iinclude2 -I/home/bunk/linux/kernel-2.6/git/linux-2.6/include -include include/linux/autoconf.h -I/home/bunk/linux/kernel-2.6/git/linux-2.6/kernel -Ikernel -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Os -fno-stack-protector -D__arch_um__ -DSUBARCH=\"i386\" -I/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/um/include -Iarch/um/include  -I/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/um/include  -I/home/bunk/linux/kernel-2.6/git/linux-2.6/arch/um/include/skas -Dvmap=kernel_vmap -Din6addr_loopback=kernel_in6addr_loopback -Din6addr_any=kernel_in6addr_any -march=i686 -mpreferred-stack-boundary=2 -ffreestanding -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask -Dmktime=kernel_mktime -fno-unit-at-a-time -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-omit-frame-pointer  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(sched)"  -D"KBUILD_MODNAME=KBUILD_STR(sched)" -c -o kernel/sched.o /home/bunk/linux/kernel-2.6/git/linux-2.6/kernel/sched.c
In file included from /home/bunk/linux/kernel-2.6/git/linux-2.6/kernel/sched.c:1213:
/home/bunk/linux/kernel-2.6/git/linux-2.6/kernel/sched_idletask.c: In function ‘check_preempt_curr_idle’:
/home/bunk/linux/kernel-2.6/git/linux-2.6/kernel/sched_idletask.c:20: internal compiler error: in cgraph_estimate_size_after_inlining, at ipa-inline.c:188
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.3/README.Bugs> for instructions.
$ gcc --version
gcc (Debian 4.3.0-1) 4.3.1 20080309 (prerelease)
Comment 1 Adrian Bunk 2008-03-17 19:11:36 UTC
Created attachment 15337 [details]
preprocessed source
Comment 2 Andrew Pinski 2008-03-17 19:14:14 UTC
First -fno-unit-at-a-time seems wrong.
Comment 3 Adrian Bunk 2008-03-17 19:23:10 UTC
That's the UML kernel, and it was added there quite some time ago.

I do not know whether that might be dropped or whether it might still result in increased stack usage with gcc 4.3, but IMHO as long as gcc offers this option it shouldn't cause an ICE.
Comment 4 Wolfgang Bangerth 2008-03-25 18:58:32 UTC
I can't reproduce this with

tmp/g> /home/bangerth/bin/x86/gcc-mainline/bin/gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../mainline/configure --prefix=/home/bangerth/bin/x86/gcc-mainline --enable-languages=c,c++ --enable-checking --with-gmp=/home/bangerth/bin/x86 --with-mpfr=/home/bangerth/bin/x86
Thread model: posix
gcc version 4.4.0 20080317 (experimental) [trunk revision 133287] (GCC) 

Can you state which flags you actually need to reproduce the bug with
your preprocessed sources?

Comment 5 Adrian Bunk 2008-03-25 19:24:47 UTC
The flags I used are in my bug description.

It seems "-Os -fno-unit-at-a-time" are the minimum flags required for reproducing it.
Comment 6 Wolfgang Bangerth 2008-03-25 19:37:09 UTC
It appears to work with "gcc version 4.4.0 20080317". Can you see if it
works for you as well with a more recent gcc version (either from top-of-tree
or the top of the 4.3 branch that you used in your experiments)?

Comment 7 Adrian Bunk 2008-03-26 13:54:38 UTC
Bug seems to be no longer present with svn HEAD.

Bug is still present in 4.3 as of 4.3-20080320.
Comment 8 Richard Biener 2008-05-23 14:35:52 UTC

Testcase, -Os -fno-unit-at-a-time

static void __resched_task(void *p, int tif_bit);
static inline __attribute__((always_inline))
void resched_task(void *p) {  __resched_task(p, 2);  }
static void __resched_task(void *p, int tif_bit) { }
void check_preempt_curr_idle(void *p)

if you put an inline onto the definition of __resched_task the testcase
also ICEs for -O and -O2, so quite likely we are more agressive with -Os
inlining but decide so after-the-fact which confuses the size estimates.

Honza, can you please have a look here?
Comment 9 Richard Biener 2008-06-06 14:59:11 UTC
4.3.1 is being released, adjusting target milestone.
Comment 10 Joseph S. Myers 2008-08-27 22:03:29 UTC
4.3.2 is released, changing milestones to 4.3.3.
Comment 11 Richard Biener 2009-01-24 10:20:12 UTC
GCC 4.3.3 is being released, adjusting target milestone.
Comment 12 Richard Biener 2009-08-04 12:28:55 UTC
GCC 4.3.4 is being released, adjusting target milestone.
Comment 13 Richard Biener 2010-05-22 18:12:12 UTC
GCC 4.3.5 is being released, adjusting target milestone.
Comment 14 Kamaraju Kusumanchi 2010-09-12 13:39:34 UTC
The reduced test case in comment #8, with options "-c -Os -fno-unit-at-a-time", does not ICE in gcc 4.4.5 20100909, gcc 4.6.0 20100828. But it gives an ICE with gcc 4.3.5.

Also, for sched.i, with options "-c -Os -fno-unit-at-a-time", there is no ICE with gcc 4.4.5 20100909, gcc 4.6.0 20100828. But it gives an ICE with gcc 4.3.5.

Just FYI.
Comment 15 Richard Biener 2011-06-27 11:23:11 UTC
Fixed for 4.4.0.