aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ipa/pr84658.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/ipa/pr84658.C')
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr84658.C30
1 files changed, 30 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ipa/pr84658.C b/gcc/testsuite/g++.dg/ipa/pr84658.C
new file mode 100644
index 00000000000..6846e1832bd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr84658.C
@@ -0,0 +1,30 @@
+/* PR ipa/84658 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fmerge-all-constants -std=c++11" } */
+
+const int kTestCasesFoo[] = { 0, 1, 2, 3, 4, 5, 8, 15, 16, 17, 512, 1020, 1021, 1022, 1023, 1024 };
+const int kTestCasesBar[] = { 0, 1, 2, 3, 4, 5, 8, 15, 16, 17, 512, 1020, 1021, 1022, 1023, 1024 };
+
+void Foo() {
+ __builtin_printf("foo:");
+ for (int count : kTestCasesFoo) {
+ __builtin_printf("%d,", count);
+ }
+ __builtin_printf(";\n");
+}
+
+void Bar() {
+ __builtin_printf("bar:");
+ for (int count : kTestCasesBar) {
+ __builtin_printf("%d,", count);
+ }
+ __builtin_printf(";\n");
+}
+
+int main() {
+ Foo();
+ Bar();
+}
+
+/* { dg-output "foo:0,1,2,3,4,5,8,15,16,17,512,1020,1021,1022,1023,1024,;(\n|\n\r|\r)*" } */
+/* { dg-output "bar:0,1,2,3,4,5,8,15,16,17,512,1020,1021,1022,1023,1024,;(\n|\n\r|\r)*" } */