[PATCH v4 06/15] fix gdb.base/access-mem-running.exp for clang testing

Bruno Larsen blarsen@redhat.com
Mon Sep 12 12:18:08 GMT 2022


thanks, pushed!

Cheers,
Bruno

On 12/09/2022 11:41, Andrew Burgess wrote:
> Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org> writes:
>
>> Clang was optimizing global_var away because it was not being used
>> anywhere. this commit fixes that by adding the attribute used it.
>> ---
>>   gdb/testsuite/gdb.base/access-mem-running.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gdb/testsuite/gdb.base/access-mem-running.c b/gdb/testsuite/gdb.base/access-mem-running.c
>> index 6335f1bf199..cff6f0da820 100644
>> --- a/gdb/testsuite/gdb.base/access-mem-running.c
>> +++ b/gdb/testsuite/gdb.base/access-mem-running.c
>> @@ -19,7 +19,7 @@
>>   
>>   static unsigned int global_counter = 1;
>>   
>> -static volatile unsigned int global_var = 123;
>> +static volatile unsigned int __attribute__((used)) global_var = 123;
>>   
>>   static void
>>   maybe_stop_here ()
> LGTM.  Feel free to merge this.
>
> Thanks,
> Andrew
>



More information about the Gdb-patches mailing list