On Mon, Nov 16, 2015 at 12:43 PM, Andre Vieira
<andre.simoesdiasvie...@arm.com> wrote:
> On 13/11/15 10:34, Richard Biener wrote:
>>
>> On Thu, Nov 12, 2015 at 4:07 PM, Andre Vieira
>> <andre.simoesdiasvie...@arm.com> wrote:
>>>
>>> Hi,
>>>
>>>    This patch changes this testcase to make sure LTO will not optimize
>>> away
>>> the assignment of the local array to a global variable which was
>>> introduced
>>> to make sure stack space was made available for the test to work.
>>>
>>>    This is correct because LTO is supposed to optimize this global away
>>> as at
>>> link time it knows this global will never be read. By adding a read of
>>> the
>>> global, LTO will no longer optimize it away.
>>
>>
>> But that's only because we can't see that bar doesn't clobber it, else
>> we would optimize away the check and get here again.  Much better
>> to mark 'dummy' with __attribute__((used)) and go away with 'g' entirely.
>>
>> Richard.
>>
>>>    Tested by running regressions for this testcase for various ARM
>>> targets.
>>>
>>>    Is this OK to commit?
>>>
>>>    Thanks,
>>>    Andre Vieira
>>>
>>> gcc/testsuite/ChangeLog:
>>> 2015-11-06  Andre Vieira  <andre.simoesdiasvie...@arm.com>
>>>
>>>          * gcc.dg/torture/stackalign/builtin-return-1.c: Added read
>>>            to global such that a write is not optimized away by LTO.
>>
>>
> Hi Richard,
>
> That would be great but __attribute__ ((used)) can only be used for static
> variables and making dummy static would defeat the purpose here.

I see.  What about volatile?

> Cheers,
> Andre
>

Reply via email to