diff mbox

Make stackalign test LTO proof

Message ID 5661AEDE.2090003@arm.com
State New
Headers show

Commit Message

Andre Vieira (lists) Dec. 4, 2015, 3:18 p.m. UTC
On 17/11/15 16:30, Andre Vieira wrote:
> On 17/11/15 12:29, Bernd Schmidt wrote:
>> On 11/16/2015 04:48 PM, Andre Vieira wrote:
>>> On 16/11/15 15:34, Joern Wolfgang Rennecke wrote:
>>>> I just happened to stumble on this problem with another port.
>>>> The volatile & test solution doesn't work, though.
>>>>
>>>> What does work, however, is:
>>>>
>>>> __asm__ ("" : : "" (dummy));
>>>>
>>> I can confirm that Joern's solution works for me too.
>>
>> Ok to make that change.
>>
>>
>> Bernd
>>
> OK, Joern will you submit a patch for this or shall I?
>
> Cheers,
> Andre
>
Hi,

Reworked following Joern's suggestion.

Is this OK?

Cheers,
Andre

gcc/testsuite/ChangeLog:
2015-12-04  Andre Vieira  <andre.simoesdiasvieira@arm.com>
             Joern Rennecke  <joern.rennecke@embecosm.com>

         * gcc.dg/torture/stackalign/builtin-return-1.c: Add an
           inline assembly read to make sure dummy is not optimized
           away by LTO.

Comments

Bernd Schmidt Dec. 4, 2015, 5:34 p.m. UTC | #1
On 12/04/2015 04:18 PM, Andre Vieira wrote:
> Reworked following Joern's suggestion.
>
> Is this OK?

Yes.


Bernd
diff mbox

Patch

From 9cee0251e69c1061a60caaf28da598eab2a1fbee Mon Sep 17 00:00:00 2001
From: Andre Simoes Dias Vieira <andsim01@arm.com>
Date: Tue, 24 Nov 2015 13:50:15 +0000
Subject: [PATCH] Fixed test to be LTO proof.

---
 gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
index af017532aeb3878ef7ad717a2743661a87a56b7d..ec4fd8a9ef33a5e755bdb33e4faa41cab0f16a60 100644
--- a/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
+++ b/gcc/testsuite/gcc.dg/torture/stackalign/builtin-return-1.c
@@ -26,15 +26,13 @@  int bar(int n)
 				   STACK_ARGUMENTS_SIZE));
 }
 
-char *g;
-
 int main(void)
 {
   /* Allocate 64 bytes on the stack to make sure that __builtin_apply
      can read at least 64 bytes above the return address.  */
   char dummy[64];
 
-  g = dummy;
+  __asm__ ("" : : "" (dummy));
 
   if (bar(1) != 2)
     abort();
-- 
1.9.1