aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr120807.c20
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr46534.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-1-lib.c27
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-1.c57
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr119291.c33
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr120630.c29
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr120677.c31
7 files changed, 197 insertions, 1 deletions
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr120807.c b/gcc/testsuite/gcc.c-torture/compile/pr120807.c
new file mode 100644
index 0000000..9b37e60
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr120807.c
@@ -0,0 +1,20 @@
+typedef __UINT8_TYPE__ uint8_t;
+typedef __UINT32_TYPE__ uint32_t;
+
+typedef struct
+{
+ uint32_t dword[2];
+ uint8_t byte[8];
+} reg64_t;
+reg64_t TestF20F_opgd, TestF20F_oped;
+
+void
+TestF20F ()
+{
+ TestF20F_opgd.dword[0] ^= TestF20F_oped.byte[0];
+ for (int i = 0; i < 8; i++)
+ if (TestF20F_opgd.dword[0] & 1)
+ TestF20F_opgd.dword[0] = TestF20F_opgd.dword[0] >> 1 ^ (uint32_t)2197175160UL;
+ else
+ TestF20F_opgd.dword[0] = TestF20F_opgd.dword[0] >> 1;
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr46534.c b/gcc/testsuite/gcc.c-torture/compile/pr46534.c
index 1894636..7f10bc0 100644
--- a/gcc/testsuite/gcc.c-torture/compile/pr46534.c
+++ b/gcc/testsuite/gcc.c-torture/compile/pr46534.c
@@ -1,4 +1,3 @@
-/* { dg-skip-if "too big" { nvptx-*-* } } */
/* PR middle-end/46534 */
extern int printf (const char *, ...);
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-1-lib.c b/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-1-lib.c
new file mode 100644
index 0000000..4403235
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-1-lib.c
@@ -0,0 +1,27 @@
+extern void abort (void);
+
+void *
+memcpy (void *dst, const void *src, __SIZE_TYPE__ n)
+{
+ const char *srcp;
+ char *dstp;
+
+ srcp = src;
+ dstp = dst;
+
+ if (dst < src)
+ {
+ if (dst + n > src)
+ abort ();
+ }
+ else
+ {
+ if (src + n > dst)
+ abort ();
+ }
+
+ while (n-- != 0)
+ *dstp++ = *srcp++;
+
+ return dst;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-1.c b/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-1.c
new file mode 100644
index 0000000..0a12b0f
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/pr22237-1.c
@@ -0,0 +1,57 @@
+extern void abort (void);
+extern void exit (int);
+struct s { unsigned char a[256]; };
+union u { struct { struct s b; int c; } d; struct { int c; struct s b; } e; };
+static union u v;
+static union u v0;
+static struct s *p = &v.d.b;
+static struct s *q = &v.e.b;
+
+struct outers
+{
+ struct s inner;
+};
+
+static inline struct s rp (void) { return *p; }
+static inline struct s rq (void) { return *q; }
+static void pq (void)
+{
+ struct outers o = {rq () };
+ *p = o.inner;
+}
+static void qp (void)
+{
+ struct outers o = {rp () };
+ *q = o.inner;
+}
+
+static void
+init (struct s *sp)
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ sp->a[i] = i;
+}
+
+static void
+check (struct s *sp)
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (sp->a[i] != i)
+ abort ();
+}
+
+void
+main_test (void)
+{
+ v = v0;
+ init (p);
+ qp ();
+ check (q);
+ v = v0;
+ init (q);
+ pq ();
+ check (p);
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr119291.c b/gcc/testsuite/gcc.c-torture/execute/pr119291.c
new file mode 100644
index 0000000..41eadf0
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr119291.c
@@ -0,0 +1,33 @@
+/* PR rtl-optimization/119291 */
+
+int a;
+long c;
+
+__attribute__((noipa)) void
+foo (int x)
+{
+ if (x != 0)
+ __builtin_abort ();
+ a = 42;
+}
+
+int
+main ()
+{
+ int e = 1;
+lab:
+ if (a < 2)
+ {
+ int b = e;
+ _Bool d = a != 0;
+ _Bool f = b != 0;
+ unsigned long g = -(d & f);
+ unsigned long h = c & g;
+ unsigned long i = ~c;
+ e = -(i & h);
+ c = e != 0;
+ a = ~e + b;
+ foo (e);
+ goto lab;
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr120630.c b/gcc/testsuite/gcc.c-torture/execute/pr120630.c
new file mode 100644
index 0000000..46cfac9
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr120630.c
@@ -0,0 +1,29 @@
+/* PR middle-end/120630 */
+
+__attribute__((noipa)) int
+foo (const char *x, ...)
+{
+ return *x;
+}
+
+int a, b, c;
+unsigned d = 1;
+
+int
+main ()
+{
+ if (a)
+ foo ("0");
+ int e = -1;
+ if (a < 1)
+ {
+ e = c;
+ if (c)
+ while (1)
+ ;
+ }
+ b = (~e + 0UL) / -1;
+ if (d > b)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr120677.c b/gcc/testsuite/gcc.c-torture/execute/pr120677.c
new file mode 100644
index 0000000..3cff04e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr120677.c
@@ -0,0 +1,31 @@
+/* PR tree-optimization/120677 */
+/* { dg-do run { target int32plus } } */
+
+unsigned a;
+int b, e;
+
+int
+foo (int d)
+{
+ switch (d)
+ {
+ case 0:
+ case 2:
+ return 0;
+ default:
+ return 1;
+ }
+}
+
+int
+main ()
+{
+ for (b = 8; b; b--)
+ if (a & 1)
+ a = a >> 1 ^ 20000000;
+ else
+ a >>= 1;
+ e = foo (0);
+ if (e || a)
+ __builtin_abort ();
+}