[AArch64] Work around PR target/64971
authorAndrew Pinski <apinski@cavium.com>
Wed, 20 Apr 2016 13:29:32 +0000 (13:29 +0000)
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>
Wed, 20 Apr 2016 13:29:32 +0000 (13:29 +0000)
2016-04-20  Andrew Pinski  <apinski@cavium.com>
            Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

PR target/64971
* config/aarch64/aarch64.md (sibcall): Force call
address to be DImode for ILP32.
(sibcall_value): Likewise.

* gcc.c-torture/compile/pr37433-1.c: New testcase.

Co-Authored-By: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
From-SVN: r235281

gcc/ChangeLog
gcc/config/aarch64/aarch64.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr37433-1.c [new file with mode: 0644]

index bac8ceb..a36a177 100644 (file)
@@ -1,3 +1,11 @@
+2016-04-20  Andrew Pinski  <apinski@cavium.com>
+            Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
+
+       PR target/64971
+       * config/aarch64/aarch64.md (sibcall): Force call
+       address to be DImode for ILP32.
+       (sibcall_value): Likewise.
+
 2016-04-20  H.J. Lu  <hongjiu.lu@intel.com>
 
        * doc/invoke.texi: Replace -skip-rax-setup with -mskip-rax-setup.
index 68676c9..f423284 100644 (file)
           || aarch64_is_noplt_call_p (callee)))
       XEXP (operands[0], 0) = force_reg (Pmode, callee);
 
+    /* FIXME: This is a band-aid.  Need to analyze why expand_expr_addr_expr
+       is generating an SImode symbol reference.  See PR 64971.  */
+    if (TARGET_ILP32
+       && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF
+       && GET_MODE (XEXP (operands[0], 0)) == SImode)
+      XEXP (operands[0], 0) = convert_memory_address (Pmode,
+                                                     XEXP (operands[0], 0));
     if (operands[2] == NULL_RTX)
       operands[2] = const0_rtx;
 
           || aarch64_is_noplt_call_p (callee)))
       XEXP (operands[1], 0) = force_reg (Pmode, callee);
 
+    /* FIXME: This is a band-aid.  Need to analyze why expand_expr_addr_expr
+       is generating an SImode symbol reference.  See PR 64971.  */
+    if (TARGET_ILP32
+       && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF
+       && GET_MODE (XEXP (operands[1], 0)) == SImode)
+      XEXP (operands[1], 0) = convert_memory_address (Pmode,
+                                                     XEXP (operands[1], 0));
+
     if (operands[3] == NULL_RTX)
       operands[3] = const0_rtx;
 
index 20d4df4..543837f 100644 (file)
@@ -1,3 +1,8 @@
+2016-04-20  Andrew Pinski  <apinski@cavium.com>
+
+       PR target/64971
+       * gcc.c-torture/compile/pr37433-1.c: New testcase.
+
 2016-04-20  Arnaud Charlet  <charlet@adacore.com>
 
        * gnat.dg/self1.adb: Remove now incorrect test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c b/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c
new file mode 100644 (file)
index 0000000..322c167
--- /dev/null
@@ -0,0 +1,11 @@
+void regex_subst(void)
+{
+  const void *subst = "";
+  (*(void (*)(int))subst) (0);
+}
+
+void foobar (void)
+{
+  int x;
+  (*(void (*)(void))&x) ();
+}