[PATCH/AARCH64] Fix gcc.c-torture/compile/pr37433.c for AARCH64:ILP32.
Andrew Pinski
pinskia@gmail.com
Mon Feb 9 05:41:00 GMT 2015
The problem here is that we get a symbol_ref which is SImode but for
the sibcall patterns we only match symbol_refs which use DImode. I
added a new testcase that tests the non-value sibcall pattern too.
OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions.
Thanks,
Andrew Pinski
ChangeLog:
* config/aarch64/aarch64.md (sibcall): Force call
address to be DImode for ILP32.
(sibcall_value): Likewise.
testsuite/ChangeLog:
* gcc.c-torture/compile/pr37433-1.c: New testcase.
-------------- next part --------------
commit e72320f54d1c6ed6f2324a3faaad02175c83887b
Author: Andrew Pinski <apinski@cavium.com>
Date: Sun Feb 8 23:05:01 2015 +0000
Fix gcc.c-torture/compile/pr37433.c for AARCH64:ILP32.
The problem here is that we get a symbol_ref which is SImode
but for the sibcall patterns we only match symbol_refs which
use DImode.
OK? Bootstrapped and tested on aarch64-linux-gnu with no regressions.
Thanks,
Andrew Pinski
* config/aarch64/aarch64.md (sibcall): Force operands[0]'s
address to be DImode for ILP32.
(sibcall_value): Likewise.
* gcc.c-torture/compile/pr37433-1.c: New testcase.
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 1f4169e..05240ba 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -687,6 +687,11 @@
&& (GET_CODE (XEXP (operands[0], 0)) != SYMBOL_REF))
XEXP (operands[0], 0) = force_reg (Pmode, XEXP (operands[0], 0));
+ 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 (DImode,
+ XEXP (operands[0], 0));
if (operands[2] == NULL_RTX)
operands[2] = const0_rtx;
@@ -717,6 +722,12 @@
&& (GET_CODE (XEXP (operands[1], 0)) != SYMBOL_REF))
XEXP (operands[1], 0) = force_reg (Pmode, XEXP (operands[1], 0));
+ 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 (DImode,
+ XEXP (operands[1], 0));
+
if (operands[3] == NULL_RTX)
operands[3] = const0_rtx;
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
index 0000000..322c167
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c
@@ -0,0 +1,11 @@
+void regex_subst(void)
+{
+ const void *subst = "";
+ (*(void (*)(int))subst) (0);
+}
+
+void foobar (void)
+{
+ int x;
+ (*(void (*)(void))&x) ();
+}
More information about the Gcc-patches
mailing list