summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2016-09-20 21:49:12 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2016-09-20 21:49:12 +0000
commitc9c81ef3c667aaa14c498a5449ec6d134b4b66ff (patch)
tree0ac440db6513ee01deb5e5dc6142769d1e5b7b2d /gcc/testsuite/c-c++-common
parent12cdcb9d74f55c165366ca1b1eeec013a0ce72ef (diff)
parent891196d7325e4c55d92d5ac5cfe7161c4f36c0ce (diff)
downloadgcc-fortran-dev.tar.gz
Merge from trunk (r239915 to r240230)fortran-dev
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/fortran-dev@240290 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r--gcc/testsuite/c-c++-common/Wlogical-not-parentheses-3.c31
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-12.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-13.c2
-rw-r--r--gcc/testsuite/c-c++-common/gomp/atomic-14.c2
-rw-r--r--gcc/testsuite/c-c++-common/pr60439.c1
-rw-r--r--gcc/testsuite/c-c++-common/torture/pr77544.c7
-rw-r--r--gcc/testsuite/c-c++-common/tsan/pr68260.c28
-rw-r--r--gcc/testsuite/c-c++-common/va-arg-va-list-type.c9
-rw-r--r--gcc/testsuite/c-c++-common/vector-subscript-7.c4
-rw-r--r--gcc/testsuite/c-c++-common/warn-ommitted-condop.c13
10 files changed, 91 insertions, 8 deletions
diff --git a/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-3.c b/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-3.c
new file mode 100644
index 00000000000..00aa747652b
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wlogical-not-parentheses-3.c
@@ -0,0 +1,31 @@
+/* PR c/77423 */
+/* { dg-do compile } */
+/* { dg-options "-Wlogical-not-parentheses" } */
+
+#ifndef __cplusplus
+# define bool _Bool
+#endif
+
+int
+f (int a, bool b, bool c)
+{
+ int r = 0;
+
+ r += !a == (b | c);
+ r += !a == (b ^ c);
+ r += !a == (b & c);
+ r += !a == ~b;
+ r += !a == ~(int) b;
+ r += !a == ((b & c) | c);
+ r += !a == ((b & c) | (b ^ c));
+ r += !a == (int) (b ^ c);
+ r += !a == (int) ~b;
+ r += !a == ~~b;
+ r += !a == ~(b | c);
+ r += !a == ~(b | (a == 1));
+ r += !a == ~(a == 1);
+
+ r += !a == ((b & c) | (b ^ a)); /* { dg-warning "logical not is only applied to the left hand side of comparison" } */
+
+ return r;
+}
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-12.c b/gcc/testsuite/c-c++-common/gomp/atomic-12.c
index 145e4201642..e9ca6503cfe 100644
--- a/gcc/testsuite/c-c++-common/gomp/atomic-12.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-12.c
@@ -1,6 +1,6 @@
/* PR middle-end/45423 */
/* { dg-do compile } */
-/* { dg-options "-fopenmp -fdump-tree-gimple -g0" } */
+/* { dg-options "-fopenmp -fdump-tree-gimple -g0 -Wno-deprecated" } */
/* atomicvar should never be referenced in between the barrier and
following #pragma omp atomic_load. */
/* { dg-final { scan-tree-dump-not "barrier\[^#\]*atomicvar" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-13.c b/gcc/testsuite/c-c++-common/gomp/atomic-13.c
index 2452035da5b..7f4afcf63ad 100644
--- a/gcc/testsuite/c-c++-common/gomp/atomic-13.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-13.c
@@ -1,6 +1,6 @@
/* PR middle-end/45423 */
/* { dg-do compile } */
-/* { dg-options "-fopenmp -fdump-tree-gimple -g0 -O2" } */
+/* { dg-options "-fopenmp -fdump-tree-gimple -g0 -O2 -Wno-deprecated" } */
/* atomicvar should never be referenced in between the barrier and
following #pragma omp atomic_load. */
/* { dg-final { scan-tree-dump-not "barrier\[^#\]*atomicvar" "gimple" } } */
diff --git a/gcc/testsuite/c-c++-common/gomp/atomic-14.c b/gcc/testsuite/c-c++-common/gomp/atomic-14.c
index f8fc9d87257..7e2345387d4 100644
--- a/gcc/testsuite/c-c++-common/gomp/atomic-14.c
+++ b/gcc/testsuite/c-c++-common/gomp/atomic-14.c
@@ -1,6 +1,6 @@
/* PR middle-end/45423 */
/* { dg-do compile } */
-/* { dg-options "-fopenmp" } */
+/* { dg-options "-fopenmp -Wno-deprecated" } */
#ifdef __cplusplus
bool *baz ();
diff --git a/gcc/testsuite/c-c++-common/pr60439.c b/gcc/testsuite/c-c++-common/pr60439.c
index 68bd33c22cb..71b397a1c7d 100644
--- a/gcc/testsuite/c-c++-common/pr60439.c
+++ b/gcc/testsuite/c-c++-common/pr60439.c
@@ -132,6 +132,7 @@ f6 (bool b)
break;
}
switch (b++) /* { dg-warning "switch condition has" } */
+ /* { dg-warning "is deprecated" "" { target c++ } 134 } */
{
case 3:
break;
diff --git a/gcc/testsuite/c-c++-common/torture/pr77544.c b/gcc/testsuite/c-c++-common/torture/pr77544.c
new file mode 100644
index 00000000000..1d1ce3ff74f
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/pr77544.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+
+struct {
+ long a : 17;
+} b;
+int c, d;
+void e() { b.a = d + c + ~(long)(302806U >> 0); }
diff --git a/gcc/testsuite/c-c++-common/tsan/pr68260.c b/gcc/testsuite/c-c++-common/tsan/pr68260.c
new file mode 100644
index 00000000000..86ffd2b2823
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/tsan/pr68260.c
@@ -0,0 +1,28 @@
+/* PR sanitizer/68260 */
+
+#include <pthread.h>
+#include <stdbool.h>
+
+bool lock;
+int counter;
+
+void *
+tf (void *arg)
+{
+ (void) arg;
+ while (__atomic_test_and_set (&lock, __ATOMIC_ACQUIRE))
+ ;
+ ++counter;
+ __atomic_clear (&lock, __ATOMIC_RELEASE);
+ return (void *) 0;
+}
+
+int
+main ()
+{
+ pthread_t thr;
+ pthread_create (&thr, 0, tf, 0);
+ tf ((void *) 0);
+ pthread_join (thr, 0);
+ return 0;
+}
diff --git a/gcc/testsuite/c-c++-common/va-arg-va-list-type.c b/gcc/testsuite/c-c++-common/va-arg-va-list-type.c
new file mode 100644
index 00000000000..cdd97cfb037
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/va-arg-va-list-type.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+__builtin_va_list *pap;
+
+void
+fn1 (void)
+{
+ __builtin_va_arg (pap, double); /* { dg-error "first argument to 'va_arg' not of type 'va_list'" } */
+}
diff --git a/gcc/testsuite/c-c++-common/vector-subscript-7.c b/gcc/testsuite/c-c++-common/vector-subscript-7.c
index e8418f24be9..8e8fa0c1bdc 100644
--- a/gcc/testsuite/c-c++-common/vector-subscript-7.c
+++ b/gcc/testsuite/c-c++-common/vector-subscript-7.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-ccp1" } */
+/* { dg-options "-O -fdump-tree-fre1" } */
typedef int v4si __attribute__ ((vector_size (16)));
@@ -11,4 +11,4 @@ main (int argc, char** argv)
return ((v4si){1, 2, 42, 0})[j];
}
-/* { dg-final { scan-tree-dump "return 42;" "ccp1" } } */
+/* { dg-final { scan-tree-dump "return 42;" "fre1" } } */
diff --git a/gcc/testsuite/c-c++-common/warn-ommitted-condop.c b/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
index 0726f043916..678373f3d70 100644
--- a/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
+++ b/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
@@ -1,11 +1,15 @@
/* { dg-options "-Wparentheses -ftrack-macro-expansion=0" } */
+#ifndef __cplusplus
+#define bool _Bool
+#endif
+
extern void f2 (int);
-void bar (int x, int y, int z)
+void bar (int x, int y, int z, bool b)
{
-#define T(op) f2 (x op y ? : 1)
-#define T2(op) f2 (x op y ? 2 : 1)
+#define T(op) f2 (x op y ? : 1)
+#define T2(op) f2 (x op y ? 2 : 1)
T(<); /* { dg-warning "omitted middle operand" } */
T(>); /* { dg-warning "omitted middle operand" } */
@@ -16,6 +20,8 @@ void bar (int x, int y, int z)
T(||); /* { dg-warning "omitted middle operand" } */
T(&&); /* { dg-warning "omitted middle operand" } */
f2 (!x ? : 1); /* { dg-warning "omitted middle operand" } */
+ f2 ((x,!x) ? : 1); /* { dg-warning "omitted middle operand" } */
+ f2 ((x,y,!x) ? : 1); /* { dg-warning "omitted middle operand" } */
T2(<); /* { dg-bogus "omitted middle operand" } */
T2(>); /* { dg-bogus "omitted middle operand" } */
T2(==); /* { dg-bogus "omitted middle operand" } */
@@ -26,4 +32,5 @@ void bar (int x, int y, int z)
T(*); /* { dg-bogus "omitted middle operand" } */
T(/); /* { dg-bogus "omitted middle operand" } */
T(^); /* { dg-bogus "omitted middle operand" } */
+ f2 (b ? : 1); /* { dg-warning "omitted middle operand" } */
}