Bug 17454 - [4.0 Regression] ICE with --enable-checking=fold
Summary: [4.0 Regression] ICE with --enable-checking=fold
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build, ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2004-09-13 11:21 UTC by Michael Cieslinski
Modified: 2005-03-16 14:53 UTC (History)
3 users (show)

See Also:
Host: powerpc-linux-gnu
Target: powerpc-linux-gnu
Build: powerpc-linux-gnu
Known to work:
Known to fail: 4.0.0
Last reconfirmed: 2004-09-13 12:32:50


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Cieslinski 2004-09-13 11:21:24 UTC
I downloaded the snapshot gcc-4.0-20040912.tar.bz2 and compiled it with:
../gcc40/configure --prefix=/usr/local/gcc40 --program-suffix=40
 --with-cpu=G5 --enable-altivec --enable-languages=c,c++
 --enable-checking=assert,misc,tree,gc,rtl,rtlflag,fold,gcac

I get following ICE:
/home/cie019/gcc40/obj/gcc/xgcc -B/home/cie019/gcc40/obj/gcc/
-B/usr/local/gcc40/powerpc-unknown-linux-gnu/bin/
-B/usr/local/gcc40/powerpc-unknown-linux-gnu/lib/ -isystem
/usr/local/gcc40/powerpc-unknown-linux-gnu/include -isystem
/usr/local/gcc40/powerpc-unknown-linux-gnu/sys-include -O2 -DIN_GCC    -W
-Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition  -isystem ./include  -I. -I. -I../../gcc40/gcc
-I../../gcc40/gcc/. -I../../gcc40/gcc/../include
-I../../gcc40/gcc/../libcpp/include   -g0 -finhibit-size-directive
-fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss
-fno-unit-at-a-time -msdata=none \
   -c ../../gcc40/gcc/crtstuff.c -DCRT_BEGIN \
  -o crtbegin.o
<built-in>:0: internal compiler error: tree check: expected record_type or
union_type or qual_union_type, have integer_type in fold_checksum_tree, at
fold-const.c:9181
Please submit a full bug report,
with preprocessed source if appropriate.

when I configure with:
../gcc40/configure --prefix=/usr/local/gcc40 --program-suffix=40
 --with-cpu=G5 --enable-altivec --enable-languages=c,c++
 --enable-checking
compilation works fine.

Michael Cieslinski
Comment 1 Giovanni Bajo 2004-09-13 12:32:48 UTC
Confirmed through double reports:
http://gcc.gnu.org/ml/gcc/2004-09/msg00712.html

Drow posted a patch, even though not on gcc-patches@.
Comment 2 Daniel Jacobowitz 2004-09-13 12:53:09 UTC
Subject: Re:  ICE with --enable-checking=assert,misc,tree,gc,rtl,rtlflag,fold,gcac

The patch is for a different problem unfortunately :-(
Comment 3 Daniel Jacobowitz 2004-09-13 12:54:58 UTC
Oops, I can't read.  Yes, I posted a patch for this.
Comment 4 Giovanni Bajo 2004-09-13 13:04:23 UTC
And sorry, the patch *was* posted to gcc-patches:
http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01150.html

BTW, i dunno if this regression also applies to 3.4 or 3.3.
Comment 5 Andrew Pinski 2004-09-13 16:23:16 UTC
Hmm, I thought I had fixed one like this before ...
Comment 6 Daniel Jacobowitz 2004-09-13 23:47:21 UTC
Checked in.
Comment 7 Michael Cieslinski 2004-09-14 15:22:58 UTC
I applied the patch, now I get:

configure:4985: checking for exception model to use
configure:5029:  /home/cie019/gcc40/obj/gcc/xgcc -shared-libgcc -
B/home/cie019/gcc40/obj/gcc/ -nostdinc++ -L/home/cie019/gcc40/obj/powerpc-
unknown-linux-gnu/libstdc++-v3/src -L/home/cie019/gcc40/obj/powerpc-unknown-
linux-gnu/libstdc++-v3/src/.libs -B/usr/local/gcc40/powerpc-unknown-linux-
gnu/bin/ -B/usr/local/gcc40/powerpc-unknown-linux-gnu/lib/ -
isystem /usr/local/gcc40/powerpc-unknown-linux-gnu/include -
isystem /usr/local/gcc40/powerpc-unknown-linux-gnu/sys-include -c -S -O2 -g -O2 
conftest.cc >&5
configure: In function `void foo()':
configure:5022: internal compiler error: in cp_tree_size, at cp/cp-objcp-
common.c:112
Please submit a full bug report,
with preprocessed source if appropriate.

in libstdc++-v3/config.log

Comment 8 Michael Cieslinski 2004-09-15 12:07:47 UTC
With the patch http://gcc.gnu.org/ml/gcc-patches/2004-09/msg01150.html
applied, I found that the configure option --enable-checking=fold causes the 
ICE compiling cp/cp-objcp-common.c

 /home/cie019/gcc40/obj/gcc/xgcc -shared-libgcc -B/home/cie019/gcc40/obj/gcc/ -
nostdinc++ -L/home/cie019/gcc40/obj/powerpc-unknown-linux-gnu/libstdc++-v3/src -
L/home/cie019/gcc40/obj/powerpc-unknown-linux-gnu/libstdc++-v3/src/.libs -
B/usr/local/gcc40/powerpc-unknown-linux-gnu/bin/ -B/usr/local/gcc40/powerpc-
unknown-linux-gnu/lib/ -isystem /usr/local/gcc40/powerpc-unknown-linux-
gnu/include -isystem /usr/local/gcc40/powerpc-unknown-linux-gnu/sys-include -E 
conftest.cc
conftest.cc: In constructor `Foo::Foo()':
conftest.cc:4: internal compiler error: in cp_tree_size, at cp/cp-objcp-
common.c:112
Please submit a full bug report,
with preprocessed source if appropriate.
Comment 9 Michael Cieslinski 2004-09-15 13:54:53 UTC
This ICE also occures on a i686 platform
Comment 10 Andrew Pinski 2004-11-27 20:36:33 UTC
Can you try again?
Comment 11 Michael Cieslinski 2004-11-29 10:46:06 UTC
I have checked it again on ppc and x86_64, it still fails on both systems.

On ppc I get:
stage1/xgcc -Bstage1/ -B/usr/local/gcc40b/powerpc-unknown-linux-gnu/bin/ -c
-g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-
prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-
definition -Werror -DHAVE_CONFIG_H    -I. -I. -I../../gcc40/gcc
-I../../gcc40/gcc/. -I../../gcc40/gcc/../include
-I../../gcc40/gcc/../libcpp/include  ../../gcc40/gcc/profile.c -o profile.o
xgcc: Internal error: Segmentation fault (program cc1)
Please submit a full bug report.

On x86_64 it fails with somthing like "unable to detect exception model"

Michael Cieslinski
Comment 12 Andrew Pinski 2005-01-28 06:31:08 UTC
I could not reproduce this on powerpc-darwin, could you try again?

This might be a stack overflow but I don't know.
Comment 13 Michael Cieslinski 2005-01-31 12:06:14 UTC
I have rechecked it at x86_64.
It occurs only with configure/make bootstrap, not with configure make.

Actual error is:

stage1/xgcc -Bstage1/ -B/usr/local/gcc40c/x86_64-unknown-linux-gnu/bin/ -c   -
g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-
prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wold-style-
definition -Werror    -DHAVE_CONFIG_H    -I. -I. -I../../gcc40/gcc -
I../../gcc40/gcc/. -I../../gcc40/gcc/../include -
I../../gcc40/gcc/../libcpp/include  ../../gcc40/gcc/dbxout.c -o dbxout.o
../../gcc40/gcc/dbxout.c: In function 'dbxout_int':
../../gcc40/gcc/dbxout.c:429: internal compiler error: fold check: original 
tree changed by fold
Please submit a full bug report, with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[2]: *** [dbxout.o] Error 1
make[2]: Leaving directory `/home/cie019/gcc40c/obj/gcc'
make[1]: *** [stage2_build] Error 2
make[1]: Leaving directory `/home/cie019/gcc40c/obj/gcc'
make: *** [bootstrap] Error 2

I will check it on ppc later

Michael Cieslinski
Comment 14 GCC Commits 2005-03-16 02:20:21 UTC
Subject: Bug 17454

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2005-03-16 02:20:08

Modified files:
	gcc            : ChangeLog tree.c fold-const.c 

Log message:
	PR tree-optimization/17454
	* tree.c (tree_size): Add case for TREE_BINFO.
	* fold-const.c (fold_checksum_tree): Only clear the overloaded
	field TYPE_CACHED_VALUES if TYPE_CACHED_VALUES_P is set.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.7865&r2=2.7866
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&r1=1.468&r2=1.469
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.542&r2=1.543

Comment 15 Andrew Pinski 2005-03-16 02:51:22 UTC
Fixed at least on the mainline, waiting for Roger to commit it the 4.0 branch after he finishes testing 
the patch which fixes this.

Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-03/msg01517.html>.
Comment 16 GCC Commits 2005-03-16 14:33:41 UTC
Subject: Bug 17454

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	sayle@gcc.gnu.org	2005-03-16 14:29:12

Modified files:
	gcc            : ChangeLog tree.c fold-const.c 

Log message:
	PR tree-optimization/17454
	* tree.c (tree_size): Add case for TREE_BINFO.
	* fold-const.c (fold_checksum_tree): Only clear the overloaded
	field TYPE_CACHED_VALUES if TYPE_CACHED_VALUES_P is set.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.54&r2=2.7592.2.55
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.466.4.1&r2=1.466.4.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.517.2.1&r2=1.517.2.2

Comment 17 Andrew Pinski 2005-03-16 14:53:39 UTC
Fixed.