aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2020-11-10 16:40:40 +0000
committerGary Benson <gbenson@redhat.com>2020-11-10 16:40:40 +0000
commit6ff174a7275512ce6f5c7a5496576a0531bd2c2f (patch)
treec656665e072211c50816418603bc55f494ec4504
parenteb24648c453c28f2898fb599311ba004394a8b41 (diff)
downloadgdb-6ff174a7275512ce6f5c7a5496576a0531bd2c2f.zip
gdb-6ff174a7275512ce6f5c7a5496576a0531bd2c2f.tar.gz
gdb-6ff174a7275512ce6f5c7a5496576a0531bd2c2f.tar.bz2
Prevent inlining in gdb.base/vla-optimized-out.c
The function f1 in gdb.base/vla-optimized-out.c sets various attributes to prevent its being inlined, but Clang inlines it anyway, causing the test that uses it to fail. This commit adds the "weak" attribute to cause Clang to keep the function fully out of line so the test can operate as it should. gdb/testsuite/ChangeLog: * gdb.base/vla-optimized-out.c (f1): Add __attribute__ ((weak)).
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/vla-optimized-out.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 863dcc4..146fa1a 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2020-11-10 Gary Benson <gbenson@redhat.com>
+ * gdb.base/vla-optimized-out.c (f1): Add __attribute__ ((weak)).
+
+2020-11-10 Gary Benson <gbenson@redhat.com>
+
* gdb.cp/step-and-next-inline.exp: Only require
-gstatement-frontiers when building with GCC.
Only setup KFAIL's for GCC issues when using
diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.c b/gdb/testsuite/gdb.base/vla-optimized-out.c
index d21df7a..1bd4f6d 100644
--- a/gdb/testsuite/gdb.base/vla-optimized-out.c
+++ b/gdb/testsuite/gdb.base/vla-optimized-out.c
@@ -22,9 +22,9 @@
int
#ifdef NOCLONE
-__attribute__((noinline)) ATTRIBUTE_NOCLONE
+__attribute__((noinline,weak)) ATTRIBUTE_NOCLONE
#else
-__attribute__((noinline))
+__attribute__((noinline,weak))
#endif
f1 (int i)
{