Bug 42775 - [4.4 regression] GCC fails to rebuild itself with STAGE1_CFLAGS=-O1
Summary: [4.4 regression] GCC fails to rebuild itself with STAGE1_CFLAGS=-O1
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.4.2
: P3 normal
Target Milestone: 4.4.5
Assignee: Eric Botcazou
URL: http://gcc.gnu.org/ml/gcc-patches/201...
Keywords: ice-on-valid-code
: 48990 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-01-17 15:52 UTC by Laurent GUERBY
Modified: 2011-05-24 18:47 UTC (History)
5 users (show)

See Also:
Host: sparc-linux
Target: sparc-linux
Build: sparc-linux
Known to work: 4.3.4
Known to fail: 4.4.0 4.4.1 4.4.2 4.4.3 4.4.4
Last reconfirmed: 2010-09-19 12:47:04


Attachments
Semi-reduced testcase (77.65 KB, text/plain)
2010-09-20 10:31 UTC, Eric Botcazou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent GUERBY 2010-01-17 15:52:14 UTC
../gcc-4.4.2/configure --enable-languages=c --disable-werror --enable-__cxa_atexit --disable-nls --enable-threads=posix --disable-multilib --prefix=/opt/cfarm/release/4.4.2 --with-cpu=v8
make bootstrap && make install
PATH=/opt/cfarm/release/4.4.2/bin:$PATH
../gcc-4.4.2/configure --enable-languages=c --disable-werror --enable-__cxa_atexit --disable-nls --enable-threads=posix --disable-multilib --prefix=/opt/cfarm/release/4.4.2-v2 --with-cpu=v8
make bootstrap STAGE1_CFLAGS=-O1

fails with

/home/guerby/build442/./gcc/xgcc -B/home/guerby/build442/./gcc/ -B/opt/cfarm/release/4.4.2-v3/sparc64-unknown-linux-gnu/bin/ -B/opt/cfarm/release/4.4.2-v3/sparc64-unknown-linux-gnu/lib/ -isystem /opt/cfarm/release/4.4.2-v3/sparc64-unknown-linux-gnu/include -isystem /opt/cfarm/release/4.4.2-v3/sparc64-unknown-linux-gnu/sys-include -g -O2 -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED   -I. -I. -I../.././gcc -I../../../gcc-4.4.2/libgcc -I../../../gcc-4.4.2/libgcc/. -I../../../gcc-4.4.2/libgcc/../gcc -I../../../gcc-4.4.2/libgcc/../include  -DHAVE_CC_TLS -o _popcountsi2.o -MT _popcountsi2.o -MD -MP -MF _popcountsi2.dep -DL_popcountsi2 -c ../../../gcc-4.4.2/libgcc/../gcc/libgcc2.c \
	  -fvisibility=hidden -DHIDE_EXPORTS
../../../gcc-4.4.2/libgcc/../gcc/libgcc2.c: In function '__popcountsi2':
../../../gcc-4.4.2/libgcc/../gcc/libgcc2.c:787: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[3]: *** [_popcountsi2.o] Error 1
make[3]: Leaving directory `/home/guerby/build442/sparc64-unknown-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/home/guerby/build442'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/guerby/build442'
make: *** [bootstrap] Error 2


Without STAGE1_CFLAGS=-O1 bootstrap works.

Note: this is gentoo bug https://bugs.gentoo.org/show_bug.cgi?id=283041
Comment 1 Richard Biener 2010-01-17 16:05:07 UTC
Please try to reproduce with the 4.4.3 release candidate.
Comment 2 Raúl Porcel 2010-01-17 19:07:23 UTC
(In reply to comment #1)
> Please try to reproduce with the 4.4.3 release candidate.
> 

gcc-4.4.3-RC-20100116 fails the same way.
Comment 3 Laurent GUERBY 2010-01-18 08:41:23 UTC
Same result for me with 4.4.3 RC1. backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x004ca580 in copy_virtual_operands ()
Current language:  auto; currently asm
(gdb) bt
#0  0x004ca580 in copy_virtual_operands ()
#1  0x003d58a0 in gimple_duplicate_bb ()
#2  0x0010be80 in duplicate_block ()
#3  0x0010f5e8 in copy_bbs ()
#4  0x00118650 in duplicate_loop_to_header_edge ()
#5  0x004b9350 in gimple_duplicate_loop_to_header_edge ()
#6  0x004a5458 in canonicalize_loop_induction_variables ()
#7  0x004a62e8 in tree_unroll_loops_completely ()
#8  0x004c4d80 in tree_complete_unroll ()
#9  0x003052b8 in execute_one_pass ()
#10 0x00305494 in execute_pass_list ()
#11 0x003054b8 in execute_pass_list ()
#12 0x003054b8 in execute_pass_list ()
#13 0x0042ba74 in tree_rest_of_compilation ()
#14 0x005d05b0 in cgraph_expand_function ()
#15 0x005d2ab8 in cgraph_optimize ()
#16 0x00028308 in c_write_global_declarations ()
#17 0x003cbbb0 in toplev_main ()
#18 0x000adaf4 in main ()
Comment 4 Laurent GUERBY 2010-03-21 19:56:52 UTC
Summary work/fail.
Comment 5 Eric Botcazou 2010-09-19 12:19:49 UTC
Investigating.
Comment 6 Eric Botcazou 2010-09-19 21:58:29 UTC
tree-ssa-operands.c:copy_virtual_operands is miscompiled by delay slot scheduling so the workaround is to use STAGE1_CFLAGS="-O1 -fno-delayed-branch".  Another way out is probably to configure with --disable-stage1-checking.
Comment 7 Eric Botcazou 2010-09-20 10:31:02 UTC
Created attachment 21847 [details]
Semi-reduced testcase

To be compiled at -O -mcpu=v8.
Comment 8 Eric Botcazou 2010-09-20 21:30:00 UTC
Subject: Bug 42775

Author: ebotcazou
Date: Mon Sep 20 21:29:48 2010
New Revision: 164458

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164458
Log:
	PR rtl-optimization/42775
	* cfgrtl.c (rest_of_pass_free_cfg): Recompute notes if delay slot
	scheduling is enabled.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cfgrtl.c

Comment 9 Eric Botcazou 2010-09-20 21:31:02 UTC
Subject: Bug 42775

Author: ebotcazou
Date: Mon Sep 20 21:30:35 2010
New Revision: 164460

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164460
Log:
	PR rtl-optimization/42775
	* cfgrtl.c (rest_of_pass_free_cfg): Recompute notes if delay slot
	scheduling is enabled.

Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/cfgrtl.c

Comment 10 Eric Botcazou 2010-09-20 21:31:34 UTC
Subject: Bug 42775

Author: ebotcazou
Date: Mon Sep 20 21:31:14 2010
New Revision: 164461

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=164461
Log:
	PR rtl-optimization/42775
	* cfgrtl.c (rest_of_pass_free_cfg): Recompute notes if delay slot
	scheduling is enabled.

Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/cfgrtl.c

Comment 11 Eric Botcazou 2010-09-20 21:35:02 UTC
At last.
Comment 12 Paul Koning 2011-05-14 01:57:26 UTC
*** Bug 48990 has been marked as a duplicate of this bug. ***
Comment 13 John David Anglin 2011-05-24 18:47:17 UTC
Author: danglin
Date: Tue May 24 18:47:14 2011
New Revision: 174133

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174133
Log:
	Backport from mainline:
	2010-09-20  Eric Botcazou  <ebotcazou@adacore.com>

	PR rtl-optimization/42775
	* cfgrtl.c (rest_of_pass_free_cfg): Recompute notes if delay slot
	scheduling is enabled.


Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/cfgrtl.c