This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][AArch64] Work around PR target/64971
- From: Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: James Greenhalgh <james dot greenhalgh at arm dot com>, Marcus Shawcroft <marcus dot shawcroft at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, Andrew Pinski <apinski at cavium dot com>, "rth at redhat dot com" <rth at redhat dot com>
- Date: Fri, 15 Apr 2016 15:10:56 +0100
- Subject: [PATCH][AArch64] Work around PR target/64971
- Authentication-results: sourceware.org; auth=none
Hi all,
This is a repost of Andrew's fix for PR target/64971 that was originally posted at:
https://gcc.gnu.org/ml/gcc-patches/2015-02/msg00502.html
The only change is that I substituted DImode for Pmode and added a FIXME comment
to remind us to revisit this (see the PR in bugzilla for more info).
Bootstrapped and tested on aarch64-none-linux-gnu (LP64, I don't have access to a full ILP32 system)
This patch affects only ILP32 codegen so I've run a make check on aarch64-none-elf with /-mabi=ilp32 and nothing regressed.
I think at this stage it's the least risky band-aid.
Is this ok for trunk at this stage?
Thanks,
Kyrill
2016-04-15 Andrew Pinski <apinski@cavium.com>
Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/65971
* config/aarch64/aarch64.md (sibcall): Force call
address to be DImode for ILP32.
(sibcall_value): Likewise.
2016-04-15 Andrew Pinski <apinski@cavium.com>
* gcc.c-torture/compile/pr37433-1.c: New testcase.
commit ff99b9cb21a195fb2b2c0e4d580db2b1e806ec97
Author: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Date: Thu Apr 14 10:52:45 2016 +0100
[AArch64] From Andrew Pinski: Work around PR target/64971
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index da85a7f..a9e811e 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -855,6 +855,13 @@ (define_expand "sibcall"
|| 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;
@@ -886,6 +893,14 @@ (define_expand "sibcall_value"
|| 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;
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) ();
+}