diff mbox

[AARCH64] PR60034

Message ID 53310C2A.6030106@linaro.org
State Accepted
Headers show

Commit Message

Kugan Vivekanandarajah March 25, 2014, 4:55 a.m. UTC
>> If I understand gcc/rtl.h correctly, SYMBOL_REF_ANCHOR_P (sym) is
>> required for anchor SYMBOL_REFS. SYMBOL_REF_BLOCK (sym) != NULL is
>> probably redundant. This can probably become an gcc_assert
>> (SYMBOL_REF_BLOCK (sym)) instead.
> 
> I agree with your interpretation of the code and comments in rtl.h.  I
> also accept that SYMBOL_REF_ANCHOR_P() is sufficient to resolve the
> test case.  However I'm wondering why we need to constraint the test
> down to SYMBOL_REF_ANCHOR_P().  At this point in the code we are
> trying to find alignment of the object, if we have a SYMBOL_REF_BLOCK
> then we can get the block alignment irrespective of
> SYMBOL_REF_ANCHOR_P().

Thanks for the explanation.  Is the attached patch looks OK ?

Thanks,
Kugan



gcc/

2014-03-25  Kugan Vivekanandarajah  <kuganv@linaro.org>

	PR target/60034
	* aarch64/aarch64.c (aarch64_classify_address): Fix alignment for
	section anchor.



gcc/testsuite/

2014-03-25  Kugan Vivekanandarajah  <kuganv@linaro.org>

	PR target/60034
	* gcc.target/aarch64/pr60034.c: New file.

Comments

Marcus Shawcroft March 25, 2014, 9:13 a.m. UTC | #1
On 25 March 2014 04:55, Kugan <kugan.vivekanandarajah@linaro.org> wrote:

> gcc/
>
> 2014-03-25  Kugan Vivekanandarajah  <kuganv@linaro.org>
>
>         PR target/60034
>         * aarch64/aarch64.c (aarch64_classify_address): Fix alignment for
>         section anchor.
>
> gcc/testsuite/
>
> 2014-03-25  Kugan Vivekanandarajah  <kuganv@linaro.org>
>
>         PR target/60034
>         * gcc.target/aarch64/pr60034.c: New file.

Thanks Kugan, leave 24h before committing to give the RM's chance to object.
/Marcus
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 57b6645..7d2d10c 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -3193,6 +3193,9 @@  aarch64_classify_address (struct aarch64_address_info *info,
 		}
 	      else if (SYMBOL_REF_DECL (sym))
 		align = DECL_ALIGN (SYMBOL_REF_DECL (sym));
+	      else if (SYMBOL_REF_HAS_BLOCK_INFO_P (sym)
+		       && SYMBOL_REF_BLOCK (sym) != NULL)
+		align = SYMBOL_REF_BLOCK (sym)->alignment;
 	      else
 		align = BITS_PER_UNIT;
 
diff --git a/gcc/testsuite/gcc.target/aarch64/pr60034.c b/gcc/testsuite/gcc.target/aarch64/pr60034.c
index e69de29..ab7e7f4 100644
--- a/gcc/testsuite/gcc.target/aarch64/pr60034.c
+++ b/gcc/testsuite/gcc.target/aarch64/pr60034.c
@@ -0,0 +1,10 @@ 
+/* { dg-do compile } */
+/* { dg-options "-std=gnu99 -O" } */
+
+static unsigned long global_max_fast;
+
+void __libc_mallopt (int param_number, int value)
+{
+ __asm__ __volatile__ ("# %[_SDT_A21]" :: [_SDT_A21] "nor" ((global_max_fast)));
+ global_max_fast = 1;
+}