summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/static4.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/opt/static4.C')
-rw-r--r--gcc/testsuite/g++.dg/opt/static4.C15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/opt/static4.C b/gcc/testsuite/g++.dg/opt/static4.C
new file mode 100644
index 000000000..87e11b027
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/static4.C
@@ -0,0 +1,15 @@
+// PR 13898
+// Make sure the two X variables get assigned unique assembler names
+// if they are promoted to static storage.
+
+// { dg-do compile }
+
+int g(int i) {
+ if (i<1) {
+ const int x[3] = { 1,2,3 };
+ return x[i];
+ } else {
+ const int x[3] = { 4,5,6 };
+ return x[i];
+ }
+}