testsuite: Add testcase for already fixed PR [PR97960]
authorJakub Jelinek <jakub@redhat.com>
Tue, 2 Feb 2021 09:01:40 +0000 (10:01 +0100)
committerJakub Jelinek <jakub@redhat.com>
Tue, 2 Feb 2021 09:01:40 +0000 (10:01 +0100)
This testcase has been fixed by
r11-5904-g4cf70c20cb10acd6fb1016611d05540728176b60
so I'm checking it in so that we can close the PR.

2021-02-02  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/97960
* g++.dg/torture/pr97960.C: New test.

gcc/testsuite/g++.dg/torture/pr97960.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/torture/pr97960.C b/gcc/testsuite/g++.dg/torture/pr97960.C
new file mode 100644 (file)
index 0000000..c6c068e
--- /dev/null
@@ -0,0 +1,30 @@
+// PR tree-optimization/97960
+// { dg-do run }
+
+#if __CHAR_BIT__ == 8 && __SIZEOF_INT__ == 4
+const int &
+foo (const int &d, const int &f)
+{
+  if (d < f)
+    return f;
+  return d;
+}
+
+short a[575];
+unsigned b[25];
+unsigned char g;
+#endif
+
+int
+main ()
+{
+#if __CHAR_BIT__ == 8 && __SIZEOF_INT__ == 4
+  for (int e = 0; e < 23; ++e)
+    a[e * 23] = 16137;
+  for (signed char h = (unsigned char) (foo (g, 253) + 3); h < 24; h++)
+    b[h] = 1064739102;
+  for (int e = 0; e < 23; ++e)
+    if (a[e * 23] != 16137)
+      __builtin_abort ();
+#endif
+}