void bar (int); void foo (int x, double y, double z) { _Bool t = z >= y; if (!t || x) bar (t ? 1 : 16); } ICEs onboth 4.7 branch and trunk at -O2 -mfloat-abi=hard with: rh817086.i: In function 'foo': rh817086.i:9:1: internal compiler error: in arm_select_dominance_cc_mode, at config/arm/arm.c:11544 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. This prevents mesa from building on arm hard float.
This happens during combine, where simplify_set on (set (reg:CC_NOOV 24 cc) (compare:CC_NOOV (ior:SI (unlt:SI (reg:CCFPE 24 cc) (const_int 0 [0])) (ne:SI (reg:SI 0 r0 [ x ]) (const_int 0 [0]))) (const_int 0 [0]))) calls SELECT_CC_MODE on the arguments of the compare (ior and const0_rtx).
Created attachment 27285 [details] gcc48-pr53187.patch Untested fix. If combine puts there (*:SI (reg:CC* cc) (const_int 0)) we should probably select the already selected CC mode, then in this case arm_select_cc_mode will return the CCFPEmode and thus the caller won't try to optimize it any way.
Hi Jakub, I have tested the patch - it works and there are no regressions in the gcc testsuite. Thus I am happy to approve the ARM specific parts of the patch (for the mainline and the 4.7 branch). Cheers Nick
Author: jakub Date: Thu May 3 10:16:01 2012 New Revision: 187085 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187085 Log: PR target/53187 * config/arm/arm.c (arm_select_cc_mode): If x has MODE_CC class mode, return that mode. * gcc.target/arm/pr53187.c: New test. * gcc.c-torture/compile/pr53187.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr53187.c trunk/gcc/testsuite/gcc.target/arm/pr53187.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/arm/arm.c trunk/gcc/testsuite/ChangeLog
Author: jakub Date: Thu May 3 10:17:02 2012 New Revision: 187086 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187086 Log: PR target/53187 * config/arm/arm.c (arm_select_cc_mode): If x has MODE_CC class mode, return that mode. * gcc.target/arm/pr53187.c: New test. * gcc.c-torture/compile/pr53187.c: New test. Added: branches/gcc-4_7-branch/gcc/testsuite/gcc.c-torture/compile/pr53187.c branches/gcc-4_7-branch/gcc/testsuite/gcc.target/arm/pr53187.c Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/config/arm/arm.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog
Fixed.