-O2 -mtune=itanium causes ICE.
Created attachment 6363 [details] A testcase make[1]: Entering directory `/export/home/hjl/bugs/gcc/itanium' /export/build/gnu/gcc-next/build-ia64-linux/gcc/xgcc -B/export/build/gnu/gcc-next/build-ia64-linux/gcc/ -O2 -mtune=itanium -c -o bar.o bar.c bar.c: In function `ia64_handle_irq': bar.c:20: internal compiler error: in bundling, at config/ia64/ia64.c:6715 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. make[1]: *** [bar.o] Error 1 make[1]: Leaving directory `/export/home/hjl/bugs/gcc/itanium' This patch http://gcc.gnu.org/ml/gcc-patches/2004-01/msg01270.html causes bootstrap failure on many platforms, including Linux/ia64. But gcc passes this testcase. This patch http://gcc.gnu.org/ml/gcc-patches/2004-01/msg01451.html may fix the bootstrap problem. But gcc fails the testcase.
Are you sure that not caused by a modified 3.4.1? As on line 6715 in ia64.c there is no abort.
I can reproduce with today's 3.4 branch. bar.c:20: internal compiler error: in bundling, at config/ia64/ia64.c:6902
The difference of the cgraph RTL dump between bad and good ones are +Final callgraph: + +ia64_handle_irq: 27 insns needed inlinable + called by: + calls: do_IRQ +do_IRQ: + called by: ia64_handle_irq + calls: The bad one is missing "Final callgraph".
The bad one died before final call graph could be dumped.
I don't understand this code well enough to easily debug it, and I am leaving for the gcc summit tomorrow. However, I did notice that if I delete the volatile from the first asm, then it works. Also, it works if I use -mvolatile-asm-stop. Since that option adds extra unnecessary stop bits, it should be an acceptable work around in the short term. I also noticed that the same workarounds worked for the testcase in 15653. I didn't try the testcase in 15655.
If I use the patch below, this testcase will pass, but not others. 2004-05-24 H.J. Lu <hongjiu.lu@intel.com> * config/ia64/itanium1.md (1_ialu_addr): Also allow I-unit. (1b_ialu_addr): Likewise. --- gcc/config/ia64/itanium1.md.bundle 2003-07-07 06:58:34.000000000 -0700 +++ gcc/config/ia64/itanium1.md 2004-05-25 11:26:10.563164935 -0700 @@ -580,7 +580,7 @@ (eq (symbol_ref "!bundling_p && ia64_produce_address_p (insn)") (const_int 1))) - "1_M") + "1_A") (define_insn_reservation "1_icmp" 1 (and (and (eq_attr "cpu" "itanium") (eq_attr "itanium_class" "icmp")) @@ -1449,7 +1449,7 @@ (eq (symbol_ref "bundling_p && ia64_produce_address_p (insn)") (const_int 1))) - "1b_M") + "1b_A") (define_insn_reservation "1b_icmp" 1 (and (and (eq_attr "cpu" "itanium") (eq_attr "itanium_class" "icmp"))
Subject: Re: [3.4 Regression]: Gcc 3.4 ICE on valid code hjl at lucon dot org wrote: > * config/ia64/itanium1.md (1_ialu_addr): Also allow I-unit. > (1b_ialu_addr): Likewise. I do not believe this patch is correct. I believe the 1*_ialu_addr patterns are deliberately using M instead of A. Use of M instead of A restricts bundling unnecessarily, however, it allows us to accurately model the latency of the operation, which is particularly important when we have an ialu instruction that generates a load/store address. Use of A would not restrict bundling, but would not let us model latencies accurately. An insn can only have one latency, but the latency of an ialu insn varies depending on whether it gets scheduled to an M slot or an I slot. Hence there is a trade off here between getting bundling right or getting latencies right. The code as written gets the latecy right when an ialu generates a load/store address, presumably to avoid an AGI stall, and gets the bundling right otherwise.
Subject: Bug 15598 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: vmakarov@gcc.gnu.org 2004-06-08 15:56:59 Modified files: gcc : ChangeLog gcc/config/ia64: ia64.c Log message: 2004-06-08 Vladimir Makarov <vmakarov@redhat.com> PR target/15598 * config/ia64/ia64.c (bundling): Add missed TYPE_A. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.480&r2=2.2326.2.481 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/ia64/ia64.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.265.2.7&r2=1.265.2.8
Subject: Bug 15598 CVSROOT: /cvs/gcc Module name: gcc Changes by: vmakarov@gcc.gnu.org 2004-06-08 15:58:29 Modified files: gcc : ChangeLog gcc/config/ia64: ia64.c Log message: 2004-06-08 Vladimir Makarov <vmakarov@redhat.com> PR target/15598 * config/ia64/ia64.c (bundling): Add missed TYPE_A. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3873&r2=2.3874 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/ia64/ia64.c.diff?cvsroot=gcc&r1=1.287&r2=1.288
Fixed.