diff mbox

[i386] : FIX PR 52882, ICE in memory_address_length, at config/i386/i386.c:23373

Message ID CAFULd4aENSTBLKgQNWp4fVFX-PkA_dykVAAhw7+vZKos2Aktjw@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak April 5, 2012, 9:52 p.m. UTC
Hello!

We can allow AND zero-extended CONST_INT operands in
ix86_decompose_address. These are sometimes generated by IRA for
certain corner cases, as in attached testcase.

2012-04-05  Uros Bizjak  <ubizjak@gmail.com>

        PR target/52882
        * config/i386/i386.c (ix86_decompose_address): Allow VOIDmode
        CONST_INT operands, zero-extended with AND.

testsuite/ChangeLog:

2012-04-05  Uros Bizjak  <ubizjak@gmail.com>

        PR target/52882
        * gcc.target/i386/pr52882.c: New test.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
{,-m32} and committed to mainline SVN.

Uros.
diff mbox

Patch

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c	(revision 186169)
+++ config/i386/i386.c	(working copy)
@@ -11510,7 +11510,7 @@  ix86_decompose_address (rtx addr, struct ix86_addr
 	    addr = SUBREG_REG (addr);
 	  else if (GET_MODE (addr) == DImode)
 	    addr = gen_rtx_SUBREG (SImode, addr, 0);
-	  else
+	  else if (GET_MODE (addr) != VOIDmode)
 	    return 0;
 	}
     }
Index: testsuite/gcc.target/i386/pr52882.c
===================================================================
--- testsuite/gcc.target/i386/pr52882.c	(revision 0)
+++ testsuite/gcc.target/i386/pr52882.c	(revision 0)
@@ -0,0 +1,19 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+struct S1 {
+  int f0;
+  int f1;
+};
+
+int fn1 ();
+void fn2 (struct S1);
+
+void
+fn3 () {
+  struct S1 a = { 1, 0 };
+  if (fn1 ())
+    fn2 (a);
+  for (; a.f1;) {
+  }
+}