aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-09-17 08:46:39 -0700
committerIan Lance Taylor <iant@golang.org>2021-09-17 08:46:39 -0700
commita0791d0ed4f147ef347e83f4aedc7ad03f1a2008 (patch)
tree7b3526910798e4cff7a7200d684383046bac6225 /gcc/testsuite/gcc.dg
parente252b51ccde010cbd2a146485d8045103cd99533 (diff)
parent89be17a1b231ade643f28fbe616d53377e069da8 (diff)
downloadgcc-a0791d0ed4f147ef347e83f4aedc7ad03f1a2008.zip
gcc-a0791d0ed4f147ef347e83f4aedc7ad03f1a2008.tar.gz
gcc-a0791d0ed4f147ef347e83f4aedc7ad03f1a2008.tar.bz2
Merge from trunk revision 89be17a1b231ade643f28fbe616d53377e069da8.
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r--gcc/testsuite/gcc.dg/Wint-in-bool-context-4.c35
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr102318.c21
2 files changed, 56 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/Wint-in-bool-context-4.c b/gcc/testsuite/gcc.dg/Wint-in-bool-context-4.c
new file mode 100644
index 0000000..0e96dd7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wint-in-bool-context-4.c
@@ -0,0 +1,35 @@
+/* PR c/102245 */
+/* { dg-options "-Wint-in-bool-context" } */
+/* { dg-do compile } */
+
+_Bool test1(_Bool x)
+{
+ return !(x << 0); /* { dg-warning "boolean context" } */
+}
+
+_Bool test2(_Bool x)
+{
+ return !(x << 1); /* { dg-warning "boolean context" } */
+}
+
+_Bool test3(_Bool x, int y)
+{
+ return !(x << y); /* { dg-warning "boolean context" } */
+}
+
+_Bool test4(int x, int y)
+{
+ return !(x << y); /* { dg-warning "boolean context" } */
+}
+
+_Bool test5(int x, int y)
+{
+ return !((x << y) << 0); /* { dg-warning "boolean context" } */
+}
+
+int test6(_Bool x)
+{
+ int v = 0;
+ return (v & ~1L) | (1L & (x << 0)); /* { dg-bogus "boolean context" } */
+}
+
diff --git a/gcc/testsuite/gcc.dg/vect/pr102318.c b/gcc/testsuite/gcc.dg/vect/pr102318.c
new file mode 100644
index 0000000..cc58efa
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr102318.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+void
+vec_slp_int16_t (short int *restrict a, short int *restrict b, int n)
+{
+ short int x0 = b[0];
+ short int x1 = b[1];
+ short int x2 = b[2];
+ short int x3 = b[3];
+ for (int i = 0; i < n; ++i)
+ {
+ x0 += a[i * 4];
+ x1 += a[i * 4 + 1];
+ x2 += a[i * 4 + 2];
+ x3 += a[i * 4 + 3];
+ }
+ b[0] = x0;
+ b[1] = x1;
+ b[2] = x2;
+ b[3] = x3;
+}