[PATCH v3 06/14] fix gdb.base/access-mem-running.exp for clang testing
Andrew Burgess
aburgess@redhat.com
Thu Jun 30 15:06:28 GMT 2022
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.
LGTM.
Thanks,
Andrew
> ---
>
> No change in v3.
>
> No change in v2.
>
> ---
> 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 ()
> --
> 2.31.1
More information about the Gdb-patches
mailing list