summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr67501.c12
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr67502.c16
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr67517.c13
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr67521.c20
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/pr56956.c15
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/pr64906.c12
-rw-r--r--gcc/testsuite/c-c++-common/ubsan/pr66908.c15
7 files changed, 103 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/gomp/pr67501.c b/gcc/testsuite/c-c++-common/gomp/pr67501.c
new file mode 100644
index 0000000000..8a7140faf2
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr67501.c
@@ -0,0 +1,12 @@
+/* PR c/67501 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+foo (void)
+{
+ int i, j;
+ #pragma omp for simd copyprivate(j /* { dg-error "before end of line" } */
+ for (i = 0; i < 16; ++i) /* { dg-error "is not valid for" "" { target *-*-* } 9 } */
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr67502.c b/gcc/testsuite/c-c++-common/gomp/pr67502.c
new file mode 100644
index 0000000000..74fef4d912
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr67502.c
@@ -0,0 +1,16 @@
+/* PR c/67502 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+/* { dg-additional-options "-std=c99" { target c } } */
+
+void bar (int, int);
+
+void
+foo (void)
+{
+#pragma omp parallel
+#pragma omp for simd collapse(2)
+ for (int i = 0; i < 16; ++i)
+ for (int j = 0; j < 16; ++j)
+ bar (i, j);
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr67517.c b/gcc/testsuite/c-c++-common/gomp/pr67517.c
new file mode 100644
index 0000000000..3055ffb34e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr67517.c
@@ -0,0 +1,13 @@
+/* PR middle-end/67517 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+int
+foo (int x, int y, int z)
+{
+ int i;
+ #pragma omp parallel for simd linear (y : x & 15) linear (x : 16) linear (z : x & 15)
+ for (i = 0; i < 256; ++i)
+ x += 16, y += x & 15, z += x & 15;
+ return x + y + z;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/pr67521.c b/gcc/testsuite/c-c++-common/gomp/pr67521.c
new file mode 100644
index 0000000000..b34c117ae3
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr67521.c
@@ -0,0 +1,20 @@
+/* PR middle-end/67521 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+void
+foo (int x)
+{
+ int i = 0;
+ #pragma omp parallel for simd
+ for (i = (i & x); i < 10; i = i + 2)
+ ;
+ i = 0;
+ #pragma omp parallel for simd
+ for (i = 0; i < (i & x) + 10; i = i + 2)
+ ;
+ i = 0;
+ #pragma omp parallel for simd
+ for (i = 0; i < 10; i = i + ((i & x) + 2))
+ ;
+}
diff --git a/gcc/testsuite/c-c++-common/ubsan/pr56956.c b/gcc/testsuite/c-c++-common/ubsan/pr56956.c
new file mode 100644
index 0000000000..996e1dd8a7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/pr56956.c
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-fsanitize=undefined -fsanitize-undefined-trap-on-error" } */
+
+unsigned int __attribute__((noinline,noclone))
+foo (unsigned int x)
+{
+ return x <= __INT_MAX__ ? x : -x;
+}
+
+int
+main ()
+{
+ volatile unsigned int tem = foo (-__INT_MAX__ - 1);
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/ubsan/pr64906.c b/gcc/testsuite/c-c++-common/ubsan/pr64906.c
new file mode 100644
index 0000000000..e0ac0eefd5
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/pr64906.c
@@ -0,0 +1,12 @@
+/* PR sanitizer/64906 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=integer-divide-by-zero -O -Werror=maybe-uninitialized" } */
+
+int
+fn1 (int f, int s)
+{
+ int ret = 0;
+ if (f)
+ ret = s / (f ? (unsigned long) 8 : 0);
+ return ret;
+}
diff --git a/gcc/testsuite/c-c++-common/ubsan/pr66908.c b/gcc/testsuite/c-c++-common/ubsan/pr66908.c
new file mode 100644
index 0000000000..5f731f0cba
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/ubsan/pr66908.c
@@ -0,0 +1,15 @@
+/* PR sanitizer/66908 */
+/* { dg-do compile } */
+/* { dg-options "-fsanitize=shift,bounds -O2 -Werror=maybe-uninitialized" } */
+/* { dg-additional-options "-std=gnu90" { target c } } */
+
+struct S { int a[22]; };
+static int const e[22] = { };
+
+void
+foo (struct S const *s, unsigned int m, unsigned int *res)
+{
+ unsigned int i;
+ for (i = 0; i < 22; ++i)
+ res[i] = ((s->a[i] + e[i]) << m);
+}