Bug 28779 - internal compiler error: in cgraph_estimate_size_after_inlining, at ipa-inline.c:106
Summary: internal compiler error: in cgraph_estimate_size_after_inlining, at ipa-inlin...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: 4.4.0
Assignee: Jan Hubicka
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: patch
Depends on: 27898 28712 28744 28755
Blocks: 27797
  Show dependency treegraph
 
Reported: 2006-08-19 09:25 UTC by David Woodhouse
Modified: 2012-01-21 21:29 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.4.0
Known to fail: 4.3.1
Last reconfirmed: 2006-08-19 21:25:25


Attachments
Test case. (264.20 KB, application/octet-stream)
2006-08-19 09:26 UTC, David Woodhouse
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Woodhouse 2006-08-19 09:25:03 UTC
See attached test case (ignore the warning; cf. pr27899):
/opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-gcc-4.1.0 -c -o e1000.o e1000_hw.i e1000_main.i --combine -fwhole-program -Os
In file included from /pmac/git/geode/include/linux/thread_info.h:22,
                 from /pmac/git/geode/include/linux/preempt.h:10,
                 from /pmac/git/geode/include/linux/spinlock.h:50,
                 from /pmac/git/geode/include/linux/capability.h:46,
                 from /pmac/git/geode/include/linux/sched.h:45,
                 from /pmac/git/geode/include/linux/module.h:10,
                 from /pmac/git/geode/drivers/net/e1000/e1000.h:38,
                 from /pmac/git/geode/drivers/net/e1000/e1000_main.c:31:
include2/asm/thread_info.h:88: warning: register used for two global register variables
/pmac/git/geode/drivers/net/e1000/e1000_main.c:4860: internal compiler error: in cgraph_estimate_size_after_inlining, at ipa-inline.c:106
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Seen with 4.1.0 i386 (with the set of patches at http://david.woodhou.se/combine/gcc-patches since otherwise it dies a lot earlier) and also with Red Hat's 4.1.1 branch with same patches, for i386 and PowerPC. The attached preprocessed source will be i386.

Sorry, I'm not sure how to cut the test case down to something smaller.
Comment 1 David Woodhouse 2006-08-19 09:26:08 UTC
Created attachment 12095 [details]
Test case.
Comment 2 David Woodhouse 2006-08-19 09:29:04 UTC
Doesn't happen with '-O', or '-O2'. Only with '-Os' or '-O3'.
Comment 3 Richard Biener 2006-08-19 15:40:39 UTC
I tried to reproduce this on a i686 host with the 4.1 branch head with no success, I get to

/obj/gcc41-g/gcc/pr28779$ ../xgcc -B.. e1000_hw.i e1000_main.i -Os -c -o e1000.o --combine -fwhole-program -Wfatal-errors -v
Reading specs from ../specs
Target: i686-pc-linux-gnu
Configured with: /home/richard/src/gcc-4_1-branch/configure --enable-languages=c,c++,fortran --enable-cxa_at_exit --enable-threads=posix
Thread model: posix
gcc version 4.1.2 20060708 (prerelease)
 ../cc1 -fpreprocessed e1000_hw.i e1000_main.i -quiet -dumpbase e1000_hw.i -mtune=pentiumpro -auxbase-strip e1000.o -Os -Wfatal-errors -version -fwhole-program -o /tmp/ccvN1UzD.s
GNU C version 4.1.2 20060715 (prerelease) (i686-pc-linux-gnu)
        compiled by GNU C version 4.1.2 20060630 (prerelease) (Debian 4.1.1-6).
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=127657
Compiler executable checksum: 024a6cd74e0904785fe447bca1336a32
In file included from /pmac/git/geode/include/linux/thread_info.h:22,
                 from /pmac/git/geode/include/linux/preempt.h:10,
                 from /pmac/git/geode/include/linux/spinlock.h:50,
                 from /pmac/git/geode/include/linux/capability.h:46,
                 from /pmac/git/geode/include/linux/sched.h:45,
                 from /pmac/git/geode/include/linux/module.h:10,
                 from /pmac/git/geode/drivers/net/e1000/e1000.h:38,
                 from /pmac/git/geode/drivers/net/e1000/e1000_main.c:31:
include2/asm/thread_info.h:88: warning: register used for two global register variables
In file included from /pmac/git/geode/include/linux/mm.h:280,
                 from /pmac/git/geode/drivers/net/e1000/e1000.h:42,
                 from /pmac/git/geode/drivers/net/e1000/e1000_main.c:31:
/pmac/git/geode/include/linux/page-flags.h:252: error: conflicting types for ‘test_clear_page_dirty’
compilation terminated due to -Wfatal-errors.

What's your output of adding -v?
Comment 4 David Woodhouse 2006-08-19 15:52:59 UTC
> /pmac/git/geode/include/linux/page-flags.h:252: error: conflicting types for
> ‘test_clear_page_dirty’

Sounds like you don't have PR27898 fixed.

With -v ...

/opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu/bin/i686-unknown-linux-gnu-gcc-4.1.1 -c -o e1000.o e1000_hw.i e1000_main.i --combine -fwhole-program -v -Os
Using built-in specs.
Target: i686-unknown-linux-gnu
Configured with: ../configure --target=i686-unknown-linux-gnu --host=powerpc64-redhat-linux --prefix=/opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu --with-headers=/opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu/i686-unknown-linux-gnu/include --with-local-prefix=/opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu/i686-unknown-linux-gnu --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-shared --enable-c99 --enable-long-long --enable-languages=c
Thread model: posix
gcc version 4.1.1 20060817 (Red Hat 4.1.1-18)
 /opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu/libexec/gcc/i686-unknown-linux-gnu/4.1.1/cc1 -fpreprocessed e1000_hw.i e1000_main.i -quiet -dumpbase e1000_hw.i -mtune=generic -auxbase-strip e1000.o -Os -version -fwhole-program -o /tmp/ccQKdpY0.s
GNU C version 4.1.1 20060817 (Red Hat 4.1.1-18) (i686-unknown-linux-gnu)
        compiled by GNU C version 4.1.1 20060525 (Red Hat 4.1.1-1.pr27898).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4a2b66e229c24ed7405efc929117b7df
In file included from /pmac/git/geode/include/linux/thread_info.h:22,
                 from /pmac/git/geode/include/linux/preempt.h:10,
                 from /pmac/git/geode/include/linux/spinlock.h:50,
                 from /pmac/git/geode/include/linux/capability.h:46,
                 from /pmac/git/geode/include/linux/sched.h:45,
                 from /pmac/git/geode/include/linux/module.h:10,
                 from /pmac/git/geode/drivers/net/e1000/e1000.h:38,
                 from /pmac/git/geode/drivers/net/e1000/e1000_main.c:31:
include2/asm/thread_info.h:88: warning: register used for two global register variables
/pmac/git/geode/drivers/net/e1000/e1000_main.c:4860: internal compiler error: in cgraph_estimate_size_after_inlining, at ipa-inline.c:106
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
make: *** [e1000.o] Error 1

Comment 5 Richard Biener 2006-08-19 16:35:27 UTC
Ok, with that fixed I can reproduce it with the mainline.  Reducing.
Comment 6 Richard Biener 2006-08-19 17:16:40 UTC
Confirmed.  Reduced testcase:

e1000_hw.i:
struct e1000_hw { };
int e1000_reset_hw(struct e1000_hw *hw) {  e1000_write_reg_io((hw), 0x00000); }
void e1000_write_reg_io(struct e1000_hw *hw, unsigned int offset)
{  unsigned long io_addr;   e1000_io_write(hw, io_addr, offset); }

e1000_main.i:
struct pci_device_id {  };
struct pci_dev {  };
struct pci_driver { int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); };
struct e1000_hw {  };
int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
struct pci_driver e1000_driver = { .probe = e1000_probe };
int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{   struct e1000_hw *adapter;   e1000_reset_hw(adapter); }
void e1000_io_write(struct e1000_hw *hw, unsigned long port, unsigned int value) { }
Comment 7 Jan Hubicka 2006-08-19 21:25:25 UTC
mine bug...
Comment 8 Jan Hubicka 2006-08-20 18:47:02 UTC
Subject: Bug 28779

Author: hubicka
Date: Sun Aug 20 18:46:54 2006
New Revision: 116274

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116274
Log:
	PR middle-end/28779
	* ipa-inline.c (cgraph_decide_inlining, cgraph_early_inlining): Compute
	function body sizes.
	* cgraphunit.c (cgraph_analyze_function): Don't do so.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraphunit.c
    trunk/gcc/ipa-inline.c

Comment 9 Steven Bosscher 2008-01-11 09:12:16 UTC
Honza, is this bug fixed by your commit of comment #8?
Comment 10 Bernhard Reutner-Fischer 2008-01-11 13:30:53 UTC
Still fails for me on trunk (revision 131461):

gcc-4.3-HEAD -Os --combine -c -o pr28779.o pr28779a.c pr28779b.c
pr28779b.c: In function 'e1000_write_reg_io':
pr28779b.c:12: 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 <http://gcc.gnu.org/bugs.html> for instructions.


$ cat pr28779a.c
/* PR middle-end/28779 */
/* { dg-do compile } */
/* { dg-options "--combine -Os" } */
/* { dg-additional-sources "pr28779b.c" } */
struct e1000_hw { };
void e1000_io_write(struct e1000_hw *hw, unsigned long port, unsigned int value);
void e1000_write_reg_io(struct e1000_hw *hw, unsigned int offset)
{  unsigned long io_addr;   e1000_io_write(hw, io_addr, offset); }
int e1000_reset_hw(struct e1000_hw *hw) {  e1000_write_reg_io((hw), 0x00000); }



$ cat pr28779b.c
/* Additional file for PR middle-end/28779 */
struct pci_device_id {  };
struct pci_dev {  };
struct pci_driver
{ int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); };
struct e1000_hw {  };
int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
struct pci_driver e1000_driver = { .probe = e1000_probe };
int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{   struct e1000_hw *adapter;   e1000_reset_hw(adapter); }
void e1000_io_write(struct e1000_hw *hw, unsigned long port, unsigned int value)
{ }

Comment 11 Jan Hubicka 2008-01-11 14:04:47 UTC
Subject: Re:  internal compiler error: in cgraph_estimate_size_after_inlining, at ipa-inline.c:106

The bug re-appeared due to yet another reorganization of IPA pass queue.
The issues with function changing their types are quite ugly, I am
looking into that now.

Honza
Comment 12 Bernhard Reutner-Fischer 2008-01-11 15:21:02 UTC
Honza, the IPA pass reordering also caused PR31529, perhaps they are related?
Comment 13 Jan Hubicka 2008-02-17 20:32:31 UTC
Patch posted.
Comment 14 Jan Hubicka 2008-02-19 17:10:27 UTC
Subject: Bug 28779

Author: hubicka
Date: Tue Feb 19 17:09:42 2008
New Revision: 132439

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=132439
Log:

	PR middle-end/28779
	* tree-inline.c (estimate_num_insns_1): Fix counting of cost of call_expr.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/tree-inline.c

Comment 15 Bernhard Reutner-Fischer 2008-07-16 12:48:41 UTC
Fixed on trunk, thanks!

Can we have the testcase in the testsuite and the fix applied to the 4_3-branch, too?
Comment 16 Joseph S. Myers 2008-08-27 22:01:28 UTC
4.3.2 is released, changing milestones to 4.3.3.
Comment 17 Richard Biener 2009-01-24 10:19:31 UTC
GCC 4.3.3 is being released, adjusting target milestone.
Comment 18 Andrew Pinski 2012-01-21 21:29:13 UTC
Closing as fixed.  Also note --combine has now been removed from 4.6 and above.