aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2023-07-10 16:21:58 -0400
committerMarek Polacek <polacek@redhat.com>2023-07-20 12:41:45 -0400
commitbdda084bc4604467587447fbc4be1c8da0a12665 (patch)
tree10d27a56fda706c91068c5ddd95ea477b9bdd34c
parent506f068e7d01ad2fb107185b8fb204a0ec23785c (diff)
downloadgcc-bdda084bc4604467587447fbc4be1c8da0a12665.zip
gcc-bdda084bc4604467587447fbc4be1c8da0a12665.tar.gz
gcc-bdda084bc4604467587447fbc4be1c8da0a12665.tar.bz2
testsuite: fix allocator-opt1.C FAIL with old ABI
Running $ make check-g++ RUNTESTFLAGS='--target_board=unix\{-D_GLIBCXX_USE_CXX11_ABI=0,\} dg.exp=allocator-opt1.C' yields: FAIL: g++.dg/tree-ssa/allocator-opt1.C -std=c++98 scan-tree-dump-times gimple "struct allocator D" 1 FAIL: g++.dg/tree-ssa/allocator-opt1.C -std=c++14 scan-tree-dump-times gimple "struct allocator D" 1 FAIL: g++.dg/tree-ssa/allocator-opt1.C -std=c++17 scan-tree-dump-times gimple "struct allocator D" 1 FAIL: g++.dg/tree-ssa/allocator-opt1.C -std=c++20 scan-tree-dump-times gimple "struct allocator D" 1 === g++ Summary for unix/-D_GLIBCXX_USE_CXX11_ABI=0 === === g++ Summary for unix === because in the old ABI we get two "struct allocator D". This patch follows r14-658 although I'm not quite sure I follow the logic there. gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/allocator-opt1.C: Force _GLIBCXX_USE_CXX11_ABI to 1.
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/allocator-opt1.C12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/tree-ssa/allocator-opt1.C b/gcc/testsuite/g++.dg/tree-ssa/allocator-opt1.C
index e8394c7..51c470d 100644
--- a/gcc/testsuite/g++.dg/tree-ssa/allocator-opt1.C
+++ b/gcc/testsuite/g++.dg/tree-ssa/allocator-opt1.C
@@ -5,8 +5,20 @@
// Currently the dump doesn't print the allocator template arg in this context.
// { dg-final { scan-tree-dump-times "struct allocator D" 1 "gimple" } }
+// In the pre-C++11 ABI we get two allocator variables.
+#undef _GLIBCXX_USE_CXX11_ABI
+#define _GLIBCXX_USE_CXX11_ABI 1
+
#include <string>
+
+// When the library is not dual-ABI and defaults to old just compile
+// an empty TU. NB: We test _GLIBCXX_USE_CXX11_ABI again because the
+// #include above might have undef'd _GLIBCXX_USE_CXX11_ABI.
+#if _GLIBCXX_USE_CXX11_ABI
+
void f (const char *p)
{
std::string lst[] = { p, p, p, p };
}
+
+#endif