As of Fri May 13 05:21:49 UTC 2005, gcc 4.0 failed to bootstrap on ia64: ./xgcc -B./ -B/usr/gcc-4.0/ia64-unknown-linux-gnu/bin/ -isystem /usr/gcc-4.0/ia64-unknown-linux-gnu/include -isystem /usr/gcc-4.0/ia64-unknown-linux-gnu/sys-include -L/export/build/gnu/gcc-4.0/build-ia64-linux/gcc/../ld -O2 -DIN_GCC -DUSE_LIBUNWIND_EXCEPTIONS -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -DUSE_GAS_SYMVER -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I/net/gnu/export/gnu/src/gcc-4.0/gcc/gcc -I/net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/. -I/net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/../include -I/net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/../libcpp/include -fexceptions -fvisibility=hidden -DHIDE_EXPORTS -c /net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/config/ia64/unwind-ia64.c -o libgcc/./unwind-ia64.o /net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/config/ia64/unwind-ia64.c: In function \uffff\uffff\uffffalloc_reg_state\uffff\uffff\uffff: /net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/config/ia64/unwind-ia64.c:312: warning: pointer targets in passing argument 1 of \uffff\uffff\uffffatomic_alloc\uffff\uffff\uffff differ in signedness/net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/config/ia64/unwind-ia64.c: In function \uffff\uffff\ufffffree_reg_state\uffff\uffff\uffff: /net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/config/ia64/unwind-ia64.c:328: warning: pointer targets in passing argument 1 of \uffff\uffff\uffffatomic_free\uffff\uffff\uffff differ in signedness /net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/config/ia64/unwind-ia64.c: In function \uffff\uffff\uffffalloc_label_state\uffff\uffff\uffff: /net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/config/ia64/unwind-ia64.c:345: warning: pointer targets in passing argument 1 of \uffff\uffff\uffffatomic_alloc\uffff\uffff\uffff differ in signedness/net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/config/ia64/unwind-ia64.c: In function \uffff\uffff\ufffffree_label_state\uffff\uffff\uffff: /net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/config/ia64/unwind-ia64.c:361: warning: pointer targets in passing argument 1 of \uffff\uffff\uffffatomic_free\uffff\uffff\uffff differ in signedness /net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/config/ia64/unwind-ia64.c: In function \uffff\uffff\uffffdesc_prologue\uffff\uffff\uffff: /net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/config/ia64/unwind-ia64.c:605: internal compiler error: Illegal instruction Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. make[5]: *** [libgcc/./unwind-ia64_s.o] Error 1 make[5]: Leaving directory `/export/build/gnu/gcc-4.0/build-ia64-linux/gcc' make[4]: *** [libgcc.a] Error 2 make[4]: Leaving directory `/export/build/gnu/gcc-4.0/build-ia64-linux/gcc' make[3]: *** [stage2_build] Error 2 make[3]: Leaving directory `/export/build/gnu/gcc-4.0/build-ia64-linux/gcc' make[2]: *** [bootstrap] Error 2 Program received signal SIGILL, Illegal instruction. 0x40000000002c9e70 in store_bit_field (str_rtx=Variable "str_rtx" is not available. ) at /net/gnu/export/gnu/src/gcc-4.0/gcc/gcc/expmed.c:742 742 if (! ((*insn_data[(int) CODE_FOR_insv].operand[3].predicate) (gdb) p/x $ip $1 = 0x40000000002c9e70 0x40000000002c9e60 <store_bit_field+4928>: [MMI] adds r14=72,r14;; 0x40000000002c9e61 <store_bit_field+4929>: ld8 r8=[r14] 0x40000000002c9e62 <store_bit_field+4930>: nop.i 0x0;; 0x40000000002c9e70 <store_bit_field+4944>: [MMI] ld8 r14=[r8],8;; 0x40000000002c9e71 <store_bit_field+4945>: ld8 r1=[r8] 0x40000000002c9e72 <store_bit_field+4946>: mov b6=r14 (gdb) p/x $r8 $2 = 0x74696e695f636576 (gdb) p/x $r14 $3 = 0x400000000073f458 (gdb) p (long *) 0x400000000073f458 $4 = (long *) 0x400000000073f458 (gdb) p *(long *) 0x400000000073f458 $5 = 8388357179805230454 (gdb) p/x *(long *) 0x400000000073f458 $6 = 0x74696e695f636576
The only change which could have caused this would be RTH but I know RTH bootstrapped and tested the patch. Are you sure that you are not using a broken binutils?
This patch http://gcc.gnu.org/ml/gcc-patches/2005-05/msg01151.html seems the cause. expmed.c compiled with the after compiler has .mii nop 0 (p6) addl r48 = @ltoffx(insn_data#+32768), r1 ;; nop 0 .mfb (p6) ld8.mov r48 = [r48], insn_data#+32768 .loc 1 638 0 nop 0 ... .loc 1 742 0 .mmi ld8 r14 = [r48] mov r54 = r38 mov r55 = r44 ;; .mmi adds r14 = 72, r14 ;; ld8 r8 = [r14] nop 0 ;; .mmi ld8 r14 = [r8], 8 ;; ld8 r1 = [r8] mov b6 = r14 .bbb nop 0 nop 0 br.call.sptk.many b0 = b6 for 740 /* If this machine's insv insists on a register, 741 get VALUE1 into a register. */ 742 if (! ((*insn_data[(int) CODE_FOR_insv].operand[3].predicate) 743 (value1, maxmode))) 744 value1 = force_reg (maxmode, value1) while the before compiler generates: .mmb addl r49 = @ltoffx(insn_data#+16384), r1 .loc 1 630 0 ld4 r39 = [r37] .loc 1 638 0 nop 0 .mmb cmp.ne p6, p7 = 39, r14 .loc 1 632 0 st4 [r37] = r15 .loc 1 638 0 (p7) br.cond.dpnt .L1908 ;; .mii ld8.mov r49 = [r49], insn_data#+16384 nop 0 ;; ... .loc 1 742 0 .mmi ld8 r14 = [r49] mov r54 = r38 mov r55 = r44 ;; .mmi adds r14 = 72, r14 ;; ld8 r8 = [r14] nop 0 ;; .mmi ld8 r14 = [r8], 8 ;; ld8 r1 = [r8] mov b6 = r14 .bbb nop 0 nop 0 br.call.sptk.many b0 = b6 The difference is "insn_data#+32768" vs. "insn_data#+16384".
I would not doubt that CODE_FOR_insv changed also after his patch so that might not be it.
FYI, I was comparing the assembly outputs from the SAME source with and without the patch mentioned. I will try to come up with a small testcase.
Created attachment 8891 [details] A testcase With the bad compiler, I got [hjl@gnu-4 gcc]$ stage1/xgcc -Bstage1/ -O2 -S /tmp/foo.c [hjl@gnu-4 gcc]$ grep "insn_data" foo.s addl r34 = @ltoffx(insn_data#+16384), r1 ld8.mov r34 = [r34], insn_data#+16384 addl r34 = @ltoffx(insn_data#+32768), r1 ld8.mov r34 = [r34], insn_data#+32768 I don't see how "insn_data#+32768" can be right.
It seems that "-fgcse -O" will trigger the bug.
The change in ia64_expand_move if (addend) { rtx subtarget = no_new_pseudos ? op0 : gen_reg_rtx (mode); emit_insn (gen_rtx_SET (VOIDmode, subtarget, op1)); op1 = expand_simple_binop (mode, PLUS, subtarget, GEN_INT (addend), op0, 1, OPTAB_DIRECT); if (op0 == op1) return NULL_RTX; } looks strange to me. Isn't addend added twice when addend == 0x4000?
A patch is posted at http://gcc.gnu.org/ml/gcc-patches/2005-05/msg01431.html
*** Bug 21552 has been marked as a duplicate of this bug. ***
*** Bug 21556 has been marked as a duplicate of this bug. ***
Subject: Bug 21551 CVSROOT: /cvs/gcc Module name: gcc Changes by: hjl@gcc.gnu.org 2005-05-16 02:12:03 Modified files: gcc : ChangeLog gcc/config/ia64: ia64.c Log message: 2005-05-15 H.J. Lu <hongjiu.lu@intel.com> PR target/21551 * config/ia64/ia64.c (ia64_expand_move): Don't add addend twice. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8793&r2=2.8794 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/ia64/ia64.c.diff?cvsroot=gcc&r1=1.363&r2=1.364
Subject: Bug 21551 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: hjl@gcc.gnu.org 2005-05-16 02:14:08 Modified files: gcc : ChangeLog gcc/config/ia64: ia64.c Log message: 2005-05-15 H.J. Lu <hongjiu.lu@intel.com> PR target/21551 * config/ia64/ia64.c (ia64_expand_move): Don't add addend twice. 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.245&r2=2.7592.2.246 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/ia64/ia64.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.347.2.5&r2=1.347.2.6
Fixed.