From ced4a4c1ccfa637940fc17dd3160727793d8b8f2 Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Tue, 6 Oct 2020 15:08:37 +0100 Subject: [PATCH] Fix gdb.base/list-ambiguous.exp with Clang The ambiguous variable parts of gdb.base/list-ambiguous.exp failed when built with Clang because the variable in question was unused and was optimized out. This commit adds __attribute__ ((used)) to both definitions. gdb/testsuite/ChangeLog: * gdb.base/list-ambiguous0.c (ambiguous_var): Add __attribute__ ((used)). * gdb.base/list-ambiguous1.c (ambiguous_var): Likewise. --- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.base/list-ambiguous0.c | 2 +- gdb/testsuite/gdb.base/list-ambiguous1.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a6ac59d5e93..f91c4dcbbf3 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2020-10-06 Gary Benson + + * gdb.base/list-ambiguous0.c (ambiguous_var): Add + __attribute__ ((used)). + * gdb.base/list-ambiguous1.c (ambiguous_var): Likewise. + 2020-10-06 Andrew Burgess * gdb.base/m32r.ld: Remove SEARCH_DIR line. Add MEMORY regions, diff --git a/gdb/testsuite/gdb.base/list-ambiguous0.c b/gdb/testsuite/gdb.base/list-ambiguous0.c index c8519cf2bed..0ad3f789c61 100644 --- a/gdb/testsuite/gdb.base/list-ambiguous0.c +++ b/gdb/testsuite/gdb.base/list-ambiguous0.c @@ -25,7 +25,7 @@ static void __attribute__ ((used)) ambiguous_fun (void) {} -static int ambiguous_var; +static int __attribute__ ((used)) ambiguous_var; diff --git a/gdb/testsuite/gdb.base/list-ambiguous1.c b/gdb/testsuite/gdb.base/list-ambiguous1.c index 19906b579f3..4de0f0e7627 100644 --- a/gdb/testsuite/gdb.base/list-ambiguous1.c +++ b/gdb/testsuite/gdb.base/list-ambiguous1.c @@ -28,7 +28,7 @@ "list"'s behavior with ambiguous linespecs. */ static void __attribute__ ((used)) ambiguous_fun (void) {} -static int ambiguous_var; +static int __attribute__ ((used)) ambiguous_var; -- 2.30.2