aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/debug/debug4.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/debug/debug4.C')
-rw-r--r--gcc/testsuite/g++.dg/debug/debug4.C17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/debug/debug4.C b/gcc/testsuite/g++.dg/debug/debug4.C
new file mode 100644
index 00000000000..8dceb0875bf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/debug4.C
@@ -0,0 +1,17 @@
+/* PR debug/5770
+ This testcase failed at -O -g because the following constants
+ were optimized away since they were never referenced, but
+ since they are variables with initializers, rtl_for_decl_location
+ run expand_expr on their initializers and returned it.
+ This lead to references to constants which were deferred and thus
+ never emitted. */
+/* { dg-do link } */
+
+static const char foo[] = "foo string";
+static const char bar[30] = "bar string";
+static const wchar_t baz[] = L"baz string";
+
+int
+main ()
+{
+}