From 6ff174a7275512ce6f5c7a5496576a0531bd2c2f Mon Sep 17 00:00:00 2001 From: Gary Benson Date: Tue, 10 Nov 2020 16:40:40 +0000 Subject: [PATCH] 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)). --- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.base/vla-optimized-out.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 863dcc43463..146fa1a086f 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2020-11-10 Gary Benson + + * gdb.base/vla-optimized-out.c (f1): Add __attribute__ ((weak)). + 2020-11-10 Gary Benson * gdb.cp/step-and-next-inline.exp: Only require diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.c b/gdb/testsuite/gdb.base/vla-optimized-out.c index d21df7a153e..1bd4f6d1406 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) { -- 2.30.2