Bug 32941

Summary: [4.3 regression] Bootstrap comparison failure
Product: gcc Reporter: andreasmeier80
Component: tree-optimizationAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: anhvofrcaus, ebotcazou, gcc-bugs, rguenther, rth, schwab, sje
Priority: P1    
Version: 4.3.0   
Target Milestone: 4.3.0   
See Also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33065
Host: Target: i686-pc-linux-gnu,ia64-*-*
Build: Known to work:
Known to fail: Last reconfirmed: 2007-07-31 13:32:01
Attachments: untested patch

Description andreasmeier80 2007-07-31 08:46:16 UTC
Bootstraping is failing for me on i686-pc-linux-gnu. At 23.07.2007 bootstrapping was successfull, but yesterday and today it fails

configure flags: --enable-languages=ada,c,c++,fortran,java,objc,obj-c++,treelang --with-mpfr=/usr/local

Here is the error message:

make[5]: Leaving directory `/data/usr_local/xxxxxx/gccobj/i686-pc-linux-gnu/libgcc'
make[4]: Leaving directory `/data/usr_local/xxxxxx/gccobj/i686-pc-linux-gnu/libgcc'
make[3]: Leaving directory `/data/usr_local/xxxxxx/gccobj/i686-pc-linux-gnu/libgcc'
make[2]: Leaving directory `/data/usr_local/xxxxxx/gccobj'
make "DESTDIR=" "RPATH_ENVVAR=LD_LIBRARY_PATH" "TARGET_SUBDIR=i686-pc-linux-gnu" "bindir=/usr/local/bin" "datadir=/usr/local/share" "exec_prefix=/usr/local" "includedir=/usr/local/include" "datarootdir=/usr/local/share" "docdir=/usr/local/share/doc" "infodir=/usr/local/info" "pdfdir=/usr/local/share/doc" "htmldir=/usr/local/share/doc" "libdir=/usr/local/lib" "libexecdir=/usr/local/libexec" "lispdir=" "localstatedir=/usr/local/var" "mandir=/usr/local/man" "oldincludedir=/usr/include" "prefix=/usr/local" "sbindir=/usr/local/sbin" "sharedstatedir=/usr/local/com" "sysconfdir=/usr/local/etc" "tooldir=/usr/local/i686-pc-linux-gnu" "build_tooldir=/usr/local/i686-pc-linux-gnu" "target_alias=i686-pc-linux-gnu" "BISON=bison" "CC_FOR_BUILD=gcc" "CFLAGS_FOR_BUILD=-g -O2" "CXX_FOR_BUILD=g++" "EXPECT=expect" "FLEX=flex" "INSTALL=/usr/bin/install -c" "INSTALL_DATA=/usr/bin/install -c -m 644" "INSTALL_PROGRAM=/usr/bin/install -c" "INSTALL_SCRIPT=/usr/bin/install -c" "LEX=flex" "M4=m4" "MAKE=make" "RUNTEST=runtest" "RUNTESTFLAGS=" "SHELL=/bin/sh" "YACC=bison -y" "`echo 'ADAFLAGS=' | sed -e s'/[^=][^=]*=$/XFOO=/'`" "AR_FLAGS=rc" "`echo 'BOOT_ADAFLAGS=' | sed -e s'/[^=][^=]*=$/XFOO=/'`" "BOOT_CFLAGS=-g -O2 -fomit-frame-pointer" "BOOT_LDFLAGS=" "CFLAGS=-g -O2" "CXXFLAGS=-g -O2" "LDFLAGS=" "LIBCFLAGS=-g -O2" "LIBCXXFLAGS=-g -O2 -fno-implicit-templates" "STAGE1_CFLAGS=-g -fkeep-inline-functions" "STAGE1_CHECKING=--enable-checking=types" "STAGE1_LANGUAGES=c,ada" "GNATBIND=gnatbind" "GNATMAKE=gnatmake" "AR_FOR_TARGET=ar" "AS_FOR_TARGET=as" "CC_FOR_TARGET=/home/xxxxxx/ul/gccobj/./gcc/xgcc -B/home/xxxxxx/ul/gccobj/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include" "CFLAGS_FOR_TARGET=-O2 -g -O2 " "CPPFLAGS_FOR_TARGET=" "CXX_FOR_TARGET=/home/xxxxxx/ul/gccobj/./gcc/g++ -B/home/xxxxxx/ul/gccobj/./gcc/ -nostdinc++  -L/home/xxxxxx/ul/gccobj/i686-pc-linux-gnu/libstdc++-v3/src -L/home/xxxxxx/ul/gccobj/i686-pc-linux-gnu/libstdc++-v3/src/.libs -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include" "CXXFLAGS_FOR_TARGET=-g -O2  -D_GNU_SOURCE" "DLLTOOL_FOR_TARGET=dlltool" "GCJ_FOR_TARGET=/home/xxxxxx/ul/gccobj/./gcc/gcj -B/home/xxxxxx/ul/gccobj/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include" "GFORTRAN_FOR_TARGET=/home/xxxxxx/ul/gccobj/./gcc/gfortran -B/home/xxxxxx/ul/gccobj/./gcc/ -B/usr/local/i686-pc-linux-gnu/bin/ -B/usr/local/i686-pc-linux-gnu/lib/ -isystem /usr/local/i686-pc-linux-gnu/include -isystem /usr/local/i686-pc-linux-gnu/sys-include" "LD_FOR_TARGET=/usr/lib/gcc/i586-suse-linux/4.1.0/../../../../i586-suse-linux/bin/ld" "LIPO_FOR_TARGET=lipo" "LDFLAGS_FOR_TARGET=" "LIBCFLAGS_FOR_TARGET=-O2 -g -O2 " "LIBCXXFLAGS_FOR_TARGET=-g -O2  -D_GNU_SOURCE -fno-implicit-templates" "NM_FOR_TARGET=nm" "OBJDUMP_FOR_TARGET=objdump" "RANLIB_FOR_TARGET=ranlib" "STRIP_FOR_TARGET=strip" "WINDRES_FOR_TARGET=windres" "WINDMC_FOR_TARGET=windmc" "`echo 'LANGUAGES=' | sed -e s'/[^=][^=]*=$/XFOO=/'`" "LEAN=false" "CONFIG_SHELL=/bin/sh" "MAKEINFO=makeinfo --split-size=5000000 --split-size=5000000"  compare
make[2]: Entering directory `/data/usr_local/xxxxxx/gccobj'
make[3]: Entering directory `/data/usr_local/xxxxxx/gccobj'
rm -f stage_current
make[3]: Leaving directory `/data/usr_local/xxxxxx/gccobj'
Comparing stages 2 and 3
warning: ./cc1plus-checksum.o differs
warning: ./cc1obj-checksum.o differs
warning: ./cc1-checksum.o differs
warning: ./cc1objplus-checksum.o differs
Bootstrap comparison failure!
./ada/exp_aggr.o differs
make[2]: *** [compare] Fehler 1
make[2]: Leaving directory `/data/usr_local/xxxxxx/gccobj'
make[1]: *** [stage3-bubble] Fehler 2
make[1]: Leaving directory `/data/usr_local/xxxxxx/gccobj'
make: *** [all] Fehler 2
Comment 1 Andreas Schwab 2007-07-31 13:32:01 UTC
The difference is created during the tree-eh pass, when try/finally is lowered.
Comment 2 Andreas Schwab 2007-07-31 14:08:08 UTC
The problem is that the goto queue is sorted by address and the cont_stmt of the first queue element is used for the final branch out.  This makes the used goto expr dependent on tree addresses.
Comment 3 Andrew Pinski 2007-08-04 01:50:28 UTC
*** Bug 32983 has been marked as a duplicate of this bug. ***
Comment 4 andreasmeier80 2007-08-09 08:43:48 UTC
It worked well with r126900, but did not with r126976
Comment 5 andreasmeier80 2007-08-09 12:52:00 UTC
It worked well with r126941, but did not with r126959
Comment 6 andreasmeier80 2007-08-09 16:07:45 UTC
It worked well with r126947, but did not with r126951
Comment 7 Steve Ellcey 2007-08-09 17:02:34 UTC
Created attachment 14047 [details]
untested patch

I can't reliably reproduce the problem but the attached patch may fix it.  It removes the sort and replaces bsearch with a simple linear search.  While bootstrapping the largest size I saw for the queue was 7.  While compiling larger C++ tests (SPEC2006) I saw it reach 30, but that is the largest I saw.  For 30 elements or less (99% of the time it is a single element) I think a linear search is reasonable.  Can someone who can reliably reproduce the problem test this patch?
Comment 8 andreasmeier80 2007-08-09 19:24:48 UTC
The regression was caused by the following patch

New Revision: 126951

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126951
Log:
2007-07-26  Richard Guenther  <rguenther@suse.de>

	toplev/
	* configure.ac: Add types checking to stage1 checking flags.
	* configure: Regenerate.

        gcc/
	* tree-cfg.c (verify_gimple_unary_expr, verify_gimple_binary_expr,
	verify_gimple_min_lval, verify_gimple_reference, verify_gimple_expr,
	verify_gimple_modify_stmt, verify_gimple_stmt, verify_gimple_1,
	verify_gimple): New functions.
	* tree-flow.h (verify_gimple): Declare.
	(verify_gimple_1): Declare.
	* gimplify.c (cpt_same_type): Remove.
	(gimplify_addr_expr): Remove checking code.
	(check_pointer_types_r): Remove.
	(gimplify_body): Call verify_gimple_1 instead of check_pointer_types_r.
	Only verify if there were no errors.
	* configure.ac: Add types checking flag.
	* configure: Regenerate.
	* config.in: Regenerate.

Modified:
    trunk/ChangeLog
    trunk/configure
    trunk/configure.ac
    trunk/gcc/config.in
    trunk/gcc/configure
    trunk/gcc/configure.ac
    trunk/gcc/gimplify.c
    trunk/gcc/tree-cfg.c
    trunk/gcc/tree-flow.h
Comment 9 andreasmeier80 2007-08-09 19:33:45 UTC
I'm now testing the patch from Comment #7.
Comment 10 andreasmeier80 2007-08-10 05:48:07 UTC
The patch works fine for me.
Comment 11 Andreas Schwab 2007-08-10 17:16:45 UTC
Looks good.
Comment 12 Steve Ellcey 2007-08-14 18:12:48 UTC
Subject: Bug 32941

Author: sje
Date: Tue Aug 14 18:12:34 2007
New Revision: 127487

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127487
Log:
	PR tree-optimization/32941
	* tree-eh.c (struct leh_tf_state): Add goto_queue_map field.
	(goto_queue_cmp): Remove.
	(find_goto_replacement): Change search method.
	(maybe_record_in_goto_queue): Add assert.
	(lower_try_finally): Remove qsort call, add pointer_map_destroy call.
	* Makefile.in (tree-eh.o): Add pointer-set.h dependency.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/tree-eh.c

Comment 13 andreasmeier80 2007-08-15 18:50:11 UTC
Fixed