diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 8 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/simd6.c | 27 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/gomp/declare-simd-1.C | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/gomp/declare-simd-2.C | 18 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/gomp/simd-1.C | 31 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/declare-simd-2.c | 17 |
10 files changed, 133 insertions, 1 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index ed60988..8f8a245 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2013-10-31 Jakub Jelinek <jakub@redhat.com> + + * c-typeck.c (c_finish_omp_clauses): Diagnose aligned clause + with decl that is not pointer nor array. + 2013-10-29 Balaji V. Iyer <balaji.v.iyer@intel.com> * c-decl.c (finish_function): Added a call for insert_cilk_frame when diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 1034cee..5a23c84 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -11504,6 +11504,14 @@ c_finish_omp_clauses (tree clauses) "%qE is not a variable in %<aligned%> clause", t); remove = true; } + else if (!POINTER_TYPE_P (TREE_TYPE (t)) + && TREE_CODE (TREE_TYPE (t)) != ARRAY_TYPE) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE in %<aligned%> clause is neither a pointer nor " + "an array", t); + remove = true; + } else if (bitmap_bit_p (&aligned_head, DECL_UID (t))) { error_at (OMP_CLAUSE_LOCATION (c), diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c7a0e5d..e7b1e25 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-10-31 Jakub Jelinek <jakub@redhat.com> + + * semantics.c (finish_omp_clauses): Diagnose aligned clause + with decl that is not pointer nor array nor reference to those. + 2013-10-31 Jason Merrill <jason@redhat.com> * semantics.c (cxx_eval_call_expression): Handle trivial diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index de3e8e7..49097f7 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5467,6 +5467,19 @@ finish_omp_clauses (tree clauses) error ("%qE is not a variable in %<aligned%> clause", t); remove = true; } + else if (!type_dependent_expression_p (t) + && TREE_CODE (TREE_TYPE (t)) != POINTER_TYPE + && TREE_CODE (TREE_TYPE (t)) != ARRAY_TYPE + && (TREE_CODE (TREE_TYPE (t)) != REFERENCE_TYPE + || (!POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (t))) + && (TREE_CODE (TREE_TYPE (TREE_TYPE (t))) + != ARRAY_TYPE)))) + { + error_at (OMP_CLAUSE_LOCATION (c), + "%qE in %<aligned%> clause is neither a pointer nor " + "an array nor a reference to pointer or array", t); + remove = true; + } else if (bitmap_bit_p (&aligned_head, DECL_UID (t))) { error ("%qD appears more than once in %<aligned%> clauses", t); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 68f93f4..b231dc8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2013-10-31 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/gomp/simd-1.C: New test. + * g++.dg/gomp/declare-simd-1.C (f32): Fix up aligned clause argument. + * g++.dg/gomp/declare-simd-2.C (fn13, fn14): Add new tests. + * gcc.dg/gomp/declare-simd-2.c (fn7, fn8, fn9, fn10, fn11): Likewise. + * c-c++-common/gomp/simd6.c: New test. + 2013-10-31 Edward Smith-Rowland <3dw4rd@verizon.net> Implement C++14 digit separators. diff --git a/gcc/testsuite/c-c++-common/gomp/simd6.c b/gcc/testsuite/c-c++-common/gomp/simd6.c new file mode 100644 index 0000000..3a90c22 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/simd6.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +extern int a[1024]; + +struct S { int i; } s; + +void +f1 (int x, float f, int *p) +{ + int i; + #pragma omp simd aligned(x : 32) /* { dg-error "neither a pointer nor an array" } */ + for (i = 0; i < 1024; i++) + a[i]++; + #pragma omp simd aligned(f) /* { dg-error "neither a pointer nor an array" } */ + for (i = 0; i < 1024; i++) + a[i]++; + #pragma omp simd aligned(s : 16) /* { dg-error "neither a pointer nor an array" } */ + for (i = 0; i < 1024; i++) + a[i]++; + #pragma omp simd aligned(a : 8) + for (i = 0; i < 1024; i++) + a[i]++; + #pragma omp simd aligned(p : 8) + for (i = 0; i < 1024; i++) + a[i]++; +} diff --git a/gcc/testsuite/g++.dg/gomp/declare-simd-1.C b/gcc/testsuite/g++.dg/gomp/declare-simd-1.C index 1fd88b7..e9be161 100644 --- a/gcc/testsuite/g++.dg/gomp/declare-simd-1.C +++ b/gcc/testsuite/g++.dg/gomp/declare-simd-1.C @@ -205,7 +205,7 @@ f30 (int x) template <int N> struct C { - #pragma omp declare simd simdlen (N) aligned (a : N * sizeof (int)) linear (c : N) notinbranch + #pragma omp declare simd simdlen (N) aligned (b : N * sizeof (int)) linear (c : N) notinbranch int f32 (int a, int *b, int c); }; diff --git a/gcc/testsuite/g++.dg/gomp/declare-simd-2.C b/gcc/testsuite/g++.dg/gomp/declare-simd-2.C index f64004f..e450a02 100644 --- a/gcc/testsuite/g++.dg/gomp/declare-simd-2.C +++ b/gcc/testsuite/g++.dg/gomp/declare-simd-2.C @@ -64,4 +64,22 @@ struct D int e; }; +#pragma omp declare simd aligned (a, b, c, d) +int fn13 (int *a, int b[64], int *&c, int (&d)[64]); + +#pragma omp declare simd aligned (a) // { dg-error "neither a pointer nor an array" } +int fn14 (int a); + +#pragma omp declare simd aligned (b) // { dg-error "neither a pointer nor an array" } +int fn14 (int &b); + +#pragma omp declare simd aligned (c) // { dg-error "neither a pointer nor an array" } +int fn14 (float c); + +#pragma omp declare simd aligned (d) // { dg-error "neither a pointer nor an array" } +int fn14 (double &d); + +#pragma omp declare simd aligned (e) // { dg-error "neither a pointer nor an array" } +int fn14 (D e); + // { dg-error "has no member" "" { target *-*-* } 61 } diff --git a/gcc/testsuite/g++.dg/gomp/simd-1.C b/gcc/testsuite/g++.dg/gomp/simd-1.C new file mode 100644 index 0000000..c9c2e73 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/simd-1.C @@ -0,0 +1,31 @@ +// { dg-do compile } +// { dg-options "-fopenmp" } + +extern int a[1024]; +int (&b)[1024] = a; + +struct S { int s; } s, &t = s; + +void +f1 (int &x, float &f, int *&p) +{ + int i; + #pragma omp simd aligned(x : 32) // { dg-error "neither a pointer nor an array" } + for (i = 0; i < 1024; i++) + a[i]++; + #pragma omp simd aligned(f) // { dg-error "neither a pointer nor an array" } + for (i = 0; i < 1024; i++) + a[i]++; + #pragma omp simd aligned(t : 16) // { dg-error "neither a pointer nor an array" } + for (i = 0; i < 1024; i++) + a[i]++; + #pragma omp simd aligned(a : 8) + for (i = 0; i < 1024; i++) + a[i]++; + #pragma omp simd aligned(b : 8) + for (i = 0; i < 1024; i++) + b[i]++; + #pragma omp simd aligned(p : 8) + for (i = 0; i < 1024; i++) + a[i]++; +} diff --git a/gcc/testsuite/gcc.dg/gomp/declare-simd-2.c b/gcc/testsuite/gcc.dg/gomp/declare-simd-2.c index 118549b..6c7de8b 100644 --- a/gcc/testsuite/gcc.dg/gomp/declare-simd-2.c +++ b/gcc/testsuite/gcc.dg/gomp/declare-simd-2.c @@ -22,3 +22,20 @@ int fn5 (int a); #pragma omp declare simd inbranch notinbranch /* { dg-error "clause is incompatible with" } */ int fn6 (int); + +#pragma omp declare simd aligned (a, b) +int fn7 (int *a, int b[64]); + +#pragma omp declare simd aligned (a) /* { dg-error "neither a pointer nor an array" } */ +int fn8 (int a); + +#pragma omp declare simd aligned (c) /* { dg-error "neither a pointer nor an array" } */ +int fn9 (float c); + +#pragma omp declare simd aligned (d) /* { dg-error "neither a pointer nor an array" } */ +int fn10 (double d); + +struct D { int d; }; + +#pragma omp declare simd aligned (e) /* { dg-error "neither a pointer nor an array" } */ +int fn11 (struct D e); |