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.
Created attachment 12095 [details] Test case.
Doesn't happen with '-O', or '-O2'. Only with '-Os' or '-O3'.
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?
> /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
Ok, with that fixed I can reproduce it with the mainline. Reducing.
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) { }
mine bug...
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
Honza, is this bug fixed by your commit of comment #8?
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) { }
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
Honza, the IPA pass reordering also caused PR31529, perhaps they are related?
Patch posted.
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
Fixed on trunk, thanks! Can we have the testcase in the testsuite and the fix applied to the 4_3-branch, too?
4.3.2 is released, changing milestones to 4.3.3.
GCC 4.3.3 is being released, adjusting target milestone.
Closing as fixed. Also note --combine has now been removed from 4.6 and above.