This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch][aarch64][PR target/83335] Fix regression, ICE on gcc.target/aarch64/asm-2.c
- From: Steve Ellcey <sellcey at cavium dot com>
- To: "Richard Earnshaw (lists)" <Richard dot Earnshaw at arm dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, "james.greenhalgh" <james dot greenhalgh at arm dot com>, Marcus Shawcroft <Marcus dot Shawcroft at arm dot com>, Christophe Lyon <christophe dot lyon at linaro dot org>
- Date: Fri, 16 Feb 2018 16:04:53 -0800
- Subject: Re: [Patch][aarch64][PR target/83335] Fix regression, ICE on gcc.target/aarch64/asm-2.c
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Steve dot Ellcey at cavium dot com;
- References: <1515190466.18339.14.camel@cavium.com> <f16c4b72-b568-6670-6b46-82af8a47b061@arm.com>
- Reply-to: sellcey at cavium dot com
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
On Thu, 2018-02-15 at 14:01 +0000, Richard Earnshaw (lists) wrote:
>
> Wouldn't it be better to call output_operand_lossage() with a suitable
> diagnostic message? If the operand isn't in Pmode assembly will
> (should) fail anyway.
>
> R.
How about this patch? In addtion to the code change I updated asm-2.c
with the error message that you getin ILP32 mode and I added asm-4.c
which does not give an error message in either LP64 or ILP32 mode.
Steve Ellcey
sellcey@cavium.com
2018-02-16 Steve Ellcey <sellcey@cavium.com>
PR target/83335
* config/aarch64/aarch64.c (aarch64_print_address_internal):
Change gcc_assert call to output_operand_lossage.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 7c9c6e5..34b75f8 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -7044,7 +7044,8 @@ aarch64_print_address_internal (FILE *f, machine_mode mode, rtx x,
unsigned int size;
/* Check all addresses are Pmode - including ILP32. */
- gcc_assert (GET_MODE (x) == Pmode);
+ if (GET_MODE (x) != Pmode)
+ output_operand_lossage ("invalid address mode");
if (aarch64_classify_address (&addr, x, mode, true, type))
switch (addr.type)
2018-02-16 Steve Ellcey <sellcey@cavium.com>
PR target/83335
* gcc/testsuite/gcc.target/aarch64/asm-2.c: Add dg-error for
ILP32 mode.
* gcc/testsuite/gcc.target/aarch64/asm-4.c: New test.
diff --git a/gcc/testsuite/gcc.target/aarch64/asm-2.c b/gcc/testsuite/gcc.target/aarch64/asm-2.c
index 3f978f5..65b3a84 100644
--- a/gcc/testsuite/gcc.target/aarch64/asm-2.c
+++ b/gcc/testsuite/gcc.target/aarch64/asm-2.c
@@ -6,5 +6,5 @@ int x;
void
f (void)
{
- asm volatile ("%a0" :: "X" (&x));
+ asm volatile ("%a0" :: "X" (&x)); /* { dg-error "invalid address mode" "" { target ilp32 } } */
}
diff --git a/gcc/testsuite/gcc.target/aarch64/asm-4.c b/gcc/testsuite/gcc.target/aarch64/asm-4.c
index e69de29..abe2af5 100644
--- a/gcc/testsuite/gcc.target/aarch64/asm-4.c
+++ b/gcc/testsuite/gcc.target/aarch64/asm-4.c
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O0" } */
+
+int x;
+
+void
+f (void)
+{
+ asm volatile ("%a0" :: "X" (__builtin_extend_pointer (&x)));
+}