re PR target/51915 (ICE in output_move_double)
authorJakub Jelinek <jakub@redhat.com>
Fri, 20 Jan 2012 19:39:48 +0000 (20:39 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 20 Jan 2012 19:39:48 +0000 (20:39 +0100)
PR target/51915
* config/arm/arm.c (arm_count_output_move_double_insns): Call
output_move_double on a copy of operands array.

* gcc.target/arm/pr51915.c: New test.

From-SVN: r183349

gcc/ChangeLog
gcc/config/arm/arm.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arm/pr51915.c [new file with mode: 0644]

index 9b05b3bf91e4b94381268a0dbee96720eee788f3..7a15ad09e59149783f360d38a4d579c7b6822d99 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/51915
+       * config/arm/arm.c (arm_count_output_move_double_insns): Call
+       output_move_double on a copy of operands array.
+
 2012-01-20   Cary Coutant  <ccoutant@google.com>
             Dodji Seketeli  <dodji@redhat.com>
 
index f6b3412521d435ff9a9dcb65915eecaa3a247c31..8f1412a8a3cd98e229c0dbfa31135b3ac8641ff2 100644 (file)
@@ -24664,7 +24664,12 @@ int
 arm_count_output_move_double_insns (rtx *operands)
 {
   int count;
-  output_move_double (operands, false, &count);
+  rtx ops[2];
+  /* output_move_double may modify the operands array, so call it
+     here on a copy of the array.  */
+  ops[0] = operands[0];
+  ops[1] = operands[1];
+  output_move_double (ops, false, &count);
   return count;
 }
 
index 860f7a89b81fb1207401e04e167b4f2c43211ad8..61eb186ba72db768d8e3b9255ddbac56328fb23a 100644 (file)
@@ -1,3 +1,8 @@
+2012-01-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/51915
+       * gcc.target/arm/pr51915.c: New test.
+
 2012-01-20   Cary Coutant  <ccoutant@google.com>
             Dodji Seketeli  <dodji@redhat.com>
 
diff --git a/gcc/testsuite/gcc.target/arm/pr51915.c b/gcc/testsuite/gcc.target/arm/pr51915.c
new file mode 100644 (file)
index 0000000..81bc4eb
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR target/51915 */
+/* { dg-do compile } */
+/* { dg-options "-march=armv7-a -mfloat-abi=hard -O2" } */
+
+struct S { int s1; void *s2; };
+struct T { struct S t1; unsigned long long t2; };
+struct S *foo (unsigned long long);
+
+struct S *
+bar (struct S *x)
+{
+  return foo (((struct T *) x)->t2);
+}