The following Fortran code, from the gamess CPU2006 benchmark, fails with an ICE on the 4.1 branch when compiled with -m32 -O3. SUBROUTINE RD2PDM(INFILE,TPDM,GBUF,LABS,NINTMX,IPIN) C IMPLICIT DOUBLE PRECISION(A-H,O-Z) LOGICAL READMORE INTEGER LABS(*),IPIN(*) DOUBLE PRECISION TPDM(*),GBUF(*) COMMON /PCKLAB/ LABSIZ C C CALL SEQREW(INFILE) READMORE = .TRUE. DO WHILE (READMORE) NG = 0 CALL PREAD(INFILE,GBUF,LABS,NG,NINTMX) IF (NG.LE.0) READMORE = .FALSE. MG = IABS(NG) DO M = 1, MG C C UNPACK LABELS C NPACK = M IF (LABSIZ .EQ. 2) THEN LABEL = LABS( 2*NPACK - 1 ) IPACK = ISHFT( LABEL, -16 ) JPACK = IAND( LABEL, 65535 ) LABEL = LABS( 2*NPACK ) KPACK = ISHFT( LABEL, -16 ) LPACK = IAND( LABEL, 65535 ) ELSE IF (LABSIZ .EQ. 1) THEN LABEL = LABS(NPACK) IPACK = ISHFT( LABEL, -24 ) JPACK = IAND( ISHFT( LABEL, -16 ), 255 ) KPACK = IAND( ISHFT( LABEL, -8 ), 255 ) LPACK = IAND( LABEL, 255 ) END IF I = IPACK J = JPACK K = KPACK L = LPACK IJ = IPIN(MAX(I,J)) + MIN(I,J) KL = IPIN(MAX(K,L)) + MIN(K,L) IJKL = IPIN(MAX(IJ,KL)) + MIN(IJ,KL) TPDM(IJKL) = GBUF(M) END DO ! CURRENT BATCH END DO ! NEXT BATCH RETURN END temp> gfortran -c -O3 -m32 gamess-failure.f gamess-failure.f: In function #rd2pdm#: gamess-failure.f:45: internal compiler error: in trunc_int_for_mode, at explow.c:54 Please submit a full bug report,
This works with "4.3.0 20061205"
Confirmed. Fails with -m32 -O -funswitch-loops. GNU C version 4.1.2 20061129 (prerelease) (SUSE Linux) (powerpc64-linux-gnu) #1 0x00000000102be550 in trunc_int_for_mode (c=0, mode=CCmode) at ../../gcc41/BUILD/gcc-4.1.2-20061129/gcc/explow.c:54 54 gcc_assert (SCALAR_INT_MODE_P (mode)); #2 0x000000001029dd58 in gen_int_mode (c=0, mode=CCmode) at ../../gcc41/BUILD/gcc-4.1.2-20061129/gcc/emit-rtl.c:404 #3 0x00000000105d1394 in simplify_const_binary_operation (code=MINUS, mode=CCmode, op0=0x400002ab400, op1=0x400002ab400) at ../../gcc41/BUILD/gcc-4.1.2-20061129/gcc/simplify-rtx.c:2573 #4 0x00000000105cb798 in simplify_binary_operation (code=MINUS, mode=CCmode, op0=0x400002ab400, op1=0x400002ab400) at ../../gcc41/BUILD/gcc-4.1.2-20061129/gcc/simplify-rtx.c:1222 #5 0x00000000105c76e8 in simplify_gen_binary (code=MINUS, mode=CCmode, op0=0x400002ab400, op1=0x400002ab400) at ../../gcc41/BUILD/gcc-4.1.2-20061129/gcc/simplify-rtx.c:124 #6 0x00000000102c6be0 in implies_p (a=0x40000400540, b=0x400004004e0) at ../../gcc41/BUILD/gcc-4.1.2-20061129/gcc/loop-iv.c:1500 #7 0x00000000102c722c in simplify_using_condition (cond=0x400003fd580, expr=0xfffffa6ad68, altered=0x0) at ../../gcc41/BUILD/gcc-4.1.2-20061129/gcc/loop-iv.c:1651 #8 0x0000000010853148 in unswitch_single_loop (loops=0x10c6fb60, loop=0x10c74e80, cond_checked=0x400003fd660, num=2) at ../../gcc41/BUILD/gcc-4.1.2-20061129/gcc/loop-unswitch.c:348 (gdb) #6 0x00000000102c6be0 in implies_p (a=0x40000400540, b=0x400004004e0) at ../../gcc41/BUILD/gcc-4.1.2-20061129/gcc/loop-iv.c:1500 1500 if (mode != VOIDmode (gdb) call debug_rtx (a) (gt:SI (reg:CC 171) (const_int 0 [0x0])) (gdb) call debug_rtx (b) (ge:SI (reg:CC 171) (const_int 0 [0x0])) which of course doesn't make sense to ask with 1500 if (mode != VOIDmode 1501 && rtx_equal_p (op1, opb1) 1502 && simplify_gen_binary (MINUS, mode, opb0, op0) == const1_rtx)1503 return true;
Subject: Bug 30113 Author: rakdver Date: Mon Dec 11 21:29:44 2006 New Revision: 119748 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=119748 Log: PR rtl-optimization/30113 * loop-iv.c (implies_p): Require the mode of the operands to be scalar. Modified: trunk/gcc/ChangeLog trunk/gcc/loop-iv.c
Subject: Bug 30113 Author: rguenth Date: Tue Jul 3 14:33:16 2007 New Revision: 126259 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126259 Log: 2007-07-03 Richard Guenther <rguenther@suse.de> Backport from mainline: 2006-12-11 Zdenek Dvorak <dvorakz@suse.cz> PR rtl-optimization/30113 * loop-iv.c (implies_p): Require the mode of the operands to be scalar. Modified: branches/gcc-4_2-branch/gcc/ChangeLog branches/gcc-4_2-branch/gcc/loop-iv.c
This is a regression from 4.0.4. Fixed on the 4.2 branch.
Subject: Bug 30113 Author: pthaugen Date: Fri Sep 21 20:17:04 2007 New Revision: 128656 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128656 Log: 2007-09-21 Pat Haugen <pthaugen@us.ibm.com> Backport the following patch: 2006-12-11 Zdenek Dvorak <dvorakz@suse.cz> PR rtl-optimization/30113 * loop-iv.c (implies_p): Require the mode of the operands to be scalar. Modified: branches/ibm/gcc-4_1-branch/gcc/ChangeLog branches/ibm/gcc-4_1-branch/gcc/loop-iv.c
How come no testcase has been committed with the fix?
Subject: Bug 30113 Author: ebotcazou Date: Fri Nov 2 12:24:44 2007 New Revision: 129849 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129849 Log: Backport from mainline: 2006-12-11 Zdenek Dvorak <dvorakz@suse.cz> PR rtl-optimization/30113 * loop-iv.c (implies_p): Require the mode of the operands to be scalar. Modified: branches/gcc-4_1-branch/gcc/ChangeLog branches/gcc-4_1-branch/gcc/loop-iv.c
Everywhere.