* [PATCH][AArch64][GCC 5] Backport Work around for PR target/64971
@ 2016-08-26 8:53 Kyrill Tkachov
2016-08-26 9:24 ` Richard Earnshaw (lists)
0 siblings, 1 reply; 2+ messages in thread
From: Kyrill Tkachov @ 2016-08-26 8:53 UTC (permalink / raw)
To: GCC Patches
Cc: Richard Earnshaw, Marcus Shawcroft, James Greenhalgh, Renlin Li,
Andrew Pinski
[-- Attachment #1: Type: text/plain, Size: 984 bytes --]
Hi all,
I'd like to backport this fix for an ILP32 ICE. This was a simple band-aid proposed by Andrew
that is self-contained and doesn't touch non-ILP32 or non-aarch64 code so it should be pretty safe
to backport. It has been in trunk and GCC 6 for quite some time without issues until Renlin's patch at r235282
fixed the midend issue [1].
Bootstrapped and tested on GCC 5 on aarch64-none-linux-gnu.
Is this patch ok for the branch?
Thanks,
Kyrill
[1] https://gcc.gnu.org/ml/gcc-patches/2016-08/msg00332.html
2016-08-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Backport from mainline
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.
PR target/64971
* gcc.c-torture/compile/pr37433 <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37433>-1.c: New testcase.
[-- Attachment #2: back-5.patch --]
[-- Type: text/x-patch, Size: 1924 bytes --]
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 116fd89102c98c5e1816998ce56cbc4d87525e97..501ae4481451b1730233eb4dfaca2a66a5b1c2ae 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -687,6 +687,13 @@ (define_expand "sibcall"
&& (GET_CODE (XEXP (operands[0], 0)) != SYMBOL_REF))
XEXP (operands[0], 0) = force_reg (Pmode, XEXP (operands[0], 0));
+ /* This is a band-aid. An SImode symbol reference is sometimes generated
+ by expand_expr_addr_expr. 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;
@@ -717,6 +724,14 @@ (define_expand "sibcall_value"
&& (GET_CODE (XEXP (operands[1], 0)) != SYMBOL_REF))
XEXP (operands[1], 0) = force_reg (Pmode, XEXP (operands[1], 0));
+ /* This is a band-aid. An SImode symbol reference is sometimes generated
+ by expand_expr_addr_expr. 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 0000000000000000000000000000000000000000..c69e9692eb0229154676fc088c41741fa30f1871
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c
@@ -0,0 +1,13 @@
+void
+regex_subst (void)
+{
+ const void *subst = "";
+ (*(void (*)(int))subst) (0);
+}
+
+void
+foobar (void)
+{
+ int x;
+ (*(void (*)(void))&x) ();
+}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][AArch64][GCC 5] Backport Work around for PR target/64971
2016-08-26 8:53 [PATCH][AArch64][GCC 5] Backport Work around for PR target/64971 Kyrill Tkachov
@ 2016-08-26 9:24 ` Richard Earnshaw (lists)
0 siblings, 0 replies; 2+ messages in thread
From: Richard Earnshaw (lists) @ 2016-08-26 9:24 UTC (permalink / raw)
To: Kyrill Tkachov, GCC Patches
Cc: Marcus Shawcroft, James Greenhalgh, Renlin Li, Andrew Pinski
On 26/08/16 09:52, Kyrill Tkachov wrote:
> Hi all,
>
> I'd like to backport this fix for an ILP32 ICE. This was a simple
> band-aid proposed by Andrew
> that is self-contained and doesn't touch non-ILP32 or non-aarch64 code
> so it should be pretty safe
> to backport. It has been in trunk and GCC 6 for quite some time without
> issues until Renlin's patch at r235282
> fixed the midend issue [1].
>
> Bootstrapped and tested on GCC 5 on aarch64-none-linux-gnu.
> Is this patch ok for the branch?
>
OK.
R.
> Thanks,
> Kyrill
>
> [1] https://gcc.gnu.org/ml/gcc-patches/2016-08/msg00332.html
>
> 2016-08-26 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
>
> Backport from mainline
> 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.
>
>
> PR target/64971
> * gcc.c-torture/compile/pr37433
> <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37433>-1.c: New testcase.
>
> back-5.patch
>
>
> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
> index 116fd89102c98c5e1816998ce56cbc4d87525e97..501ae4481451b1730233eb4dfaca2a66a5b1c2ae 100644
> --- a/gcc/config/aarch64/aarch64.md
> +++ b/gcc/config/aarch64/aarch64.md
> @@ -687,6 +687,13 @@ (define_expand "sibcall"
> && (GET_CODE (XEXP (operands[0], 0)) != SYMBOL_REF))
> XEXP (operands[0], 0) = force_reg (Pmode, XEXP (operands[0], 0));
>
> + /* This is a band-aid. An SImode symbol reference is sometimes generated
> + by expand_expr_addr_expr. 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;
>
> @@ -717,6 +724,14 @@ (define_expand "sibcall_value"
> && (GET_CODE (XEXP (operands[1], 0)) != SYMBOL_REF))
> XEXP (operands[1], 0) = force_reg (Pmode, XEXP (operands[1], 0));
>
> + /* This is a band-aid. An SImode symbol reference is sometimes generated
> + by expand_expr_addr_expr. 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 0000000000000000000000000000000000000000..c69e9692eb0229154676fc088c41741fa30f1871
> --- /dev/null
> +++ b/gcc/testsuite/gcc.c-torture/compile/pr37433-1.c
> @@ -0,0 +1,13 @@
> +void
> +regex_subst (void)
> +{
> + const void *subst = "";
> + (*(void (*)(int))subst) (0);
> +}
> +
> +void
> +foobar (void)
> +{
> + int x;
> + (*(void (*)(void))&x) ();
> +}
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-26 9:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-26 8:53 [PATCH][AArch64][GCC 5] Backport Work around for PR target/64971 Kyrill Tkachov
2016-08-26 9:24 ` Richard Earnshaw (lists)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).