aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-01-06 10:52:34 +0100
committerJakub Jelinek <jakub@redhat.com>2023-01-06 10:52:34 +0100
commitb990e80e39b41ec028d018eac7d2d040a537b681 (patch)
tree9f031424675f8219e6a929dc6cc3fce8c749b230
parent5977d14a6081184ba10a671585e553e1e9ac0112 (diff)
downloadgcc-b990e80e39b41ec028d018eac7d2d040a537b681.zip
gcc-b990e80e39b41ec028d018eac7d2d040a537b681.tar.gz
gcc-b990e80e39b41ec028d018eac7d2d040a537b681.tar.bz2
testsuite: Add testcases from PR108292 and PR108308
These PRs were for now fixed by reversion of the r13-4977 patch, but so that the problems don't reappear during stage 1, I'm adding testcase coverage from those PRs. 2023-01-06 Jakub Jelinek <jakub@redhat.com> PR target/108292 PR target/108308 * gcc.c-torture/execute/pr108292.c: New test. * gcc.target/i386/pr108292.c: New test. * gcc.dg/pr108308.c: New test.
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr108292.c18
-rw-r--r--gcc/testsuite/gcc.dg/pr108308.c39
-rw-r--r--gcc/testsuite/gcc.target/i386/pr108292.c15
3 files changed, 72 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr108292.c b/gcc/testsuite/gcc.c-torture/execute/pr108292.c
new file mode 100644
index 0000000..665724d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr108292.c
@@ -0,0 +1,18 @@
+/* PR target/108292 */
+
+typedef unsigned V __attribute__((__vector_size__ (64)));
+
+V x;
+
+int
+main ()
+{
+ if (sizeof (unsigned) * __CHAR_BIT__ != 32)
+ return 0;
+ __builtin_sub_overflow (0, 6, &x[5]);
+ x >>= ((V){} != x) & 31;
+ for (unsigned i = 0; i < 16; i++)
+ if (x[i] != (i == 5))
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/pr108308.c b/gcc/testsuite/gcc.dg/pr108308.c
new file mode 100644
index 0000000..c227626
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr108308.c
@@ -0,0 +1,39 @@
+/* PR target/108308 */
+/* { dg-do run { target { ilp32 || lp64 } } } */
+/* { dg-options "-Os -fno-tree-ccp" } */
+
+int a = 1, *d = &a, f = 2766708631, h;
+unsigned b = -1, c, e, g;
+
+static void
+foo (int j)
+{
+ if (a)
+ {
+ c = ~c;
+ while (e)
+ j = 0;
+ goto k;
+ }
+l:
+ h = 1;
+k:
+ *d = (!j) | 80;
+ int m = ~(~(-1 / b) | (a ^ 1)), n = ~(~g / (11 >> m)), o = -1 / n;
+ if (f)
+ {
+ b = 9518150474215344 ^ ~f;
+ f = 0;
+ if (c)
+ goto l;
+ if (o)
+ goto k;
+ }
+}
+
+int
+main ()
+{
+ foo (1);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr108292.c b/gcc/testsuite/gcc.target/i386/pr108292.c
new file mode 100644
index 0000000..a28a643
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr108292.c
@@ -0,0 +1,15 @@
+/* PR target/108292 */
+/* { dg-do compile } */
+/* { dg-options "-Ofast -march=alderlake" } */
+
+extern void foo (float *);
+
+extern int x;
+
+int
+bar (void)
+{
+ float y;
+ foo (&y);
+ return y > x ? 1 : 2;
+}