Bug 53187 - ICE in arm_select_dominance_cc_mode
ICE in arm_select_dominance_cc_mode
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: target
4.7.0
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
: ice-on-valid-code
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-02 08:12 UTC by Jakub Jelinek
Modified: 2012-05-03 10:28 UTC (History)
2 users (show)

See Also:
Host:
Target: armv7hl-linux-gnueabi
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-05-02 00:00:00


Attachments
gcc48-pr53187.patch (1.27 KB, patch)
2012-05-02 09:50 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2012-05-02 08:12:40 UTC
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.
Comment 1 Jakub Jelinek 2012-05-02 09:33:29 UTC
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).
Comment 2 Jakub Jelinek 2012-05-02 09:50:22 UTC
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.
Comment 3 Nick Clifton 2012-05-03 07:44:12 UTC
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
Comment 4 Jakub Jelinek 2012-05-03 10:16:05 UTC
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
Comment 5 Jakub Jelinek 2012-05-03 10:17:06 UTC
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
Comment 6 Jakub Jelinek 2012-05-03 10:28:49 UTC
Fixed.