re PR middle-end/53698 (ICE: in plus_constant, at explow.c:88 with -O -mx32 -maddress...
authorRichard Sandiford <rdsandiford@googlemail.com>
Mon, 18 Jun 2012 09:32:51 +0000 (09:32 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 18 Jun 2012 09:32:51 +0000 (09:32 +0000)
gcc/
PR middle-end/53698
* expr.c (expand_expr_addr_expr_1): Convert to tmode before
performing an addition.

gcc/testsuite/
PR middle-end/53698
* gcc.target/i386/pr53698.c: New test.

From-SVN: r188725

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr53698.c [new file with mode: 0644]

index 7c9b56e57071957174a44481dab5fd1d1031a55e..be59b02de53df4352b74f61c0169706a9a25a3e5 100644 (file)
@@ -1,3 +1,9 @@
+2012-06-18  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       PR middle-end/53698
+       * expr.c (expand_expr_addr_expr_1): Convert to tmode before
+       performing an addition.
+
 2012-06-17  Steven Bosscher  <steven@gcc.gnu.org>
 
        * output.h (split_double): Move prototype to rtl.h.
index 6012c5d318905ce59ba3ce8135e10097972abb90..cad5b10b6b0f4f1b52b4e25cd84f0fc89748ffec 100644 (file)
@@ -7630,6 +7630,7 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
         of such an object.  */
       gcc_assert ((bitpos % BITS_PER_UNIT) == 0);
 
+      result = convert_memory_address_addr_space (tmode, result, as);
       result = plus_constant (tmode, result, bitpos / BITS_PER_UNIT);
       if (modifier < EXPAND_SUM)
        result = force_operand (result, target);
index 905c4bba64ded50d85aa2a0d29f1626b827e5012..ccdc4ca8a1632d0ac215d342a943d689779d560a 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-18  Richard Sandiford  <rdsandiford@googlemail.com>
+
+       PR middle-end/53698
+       * gcc.target/i386/pr53698.c: New test.
+
 2012-06-17  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/pr33329.c (f): Increase tabs array to 1024.
diff --git a/gcc/testsuite/gcc.target/i386/pr53698.c b/gcc/testsuite/gcc.target/i386/pr53698.c
new file mode 100644 (file)
index 0000000..3acefba
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-options "-O -mx32 -maddress-mode=long -fno-tree-dominator-opts" } */
+
+extern char foo[];
+
+void
+test2 (void)
+{
+  int s;
+  for (s = 0;; ++s)
+    {
+      if (foo[s] != s)
+       __builtin_abort ();
+      foo[s] = s;
+    }
+}