diff options
author | Jakub Jelinek <jakub@redhat.com> | 2015-10-13 07:07:11 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2015-10-13 07:07:11 +0000 |
commit | 9d65ac6e5e420128432759fd9b1e678b4f9684be (patch) | |
tree | c032fa7ea49863e5f12acf18338dcd489ebeee5e | |
parent | 700cc4bad59d26dd14227280620ec73489be3aa3 (diff) |
c/
* c-typeck.c (c_finish_omp_clauses): Disallow modifiers on simd/for
constructs.
cp/
* semantics.c (finish_omp_clauses): Disallow modifiers on simd/for
constructs.
testsuite/
* c-c++-common/gomp/linear-1.c: New test.
* g++.dg/gomp/linear-1.C: New test.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gomp-4_1-branch@228744 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/c/ChangeLog.gomp | 5 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 8 | ||||
-rw-r--r-- | gcc/cp/ChangeLog.gomp | 5 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog.gomp | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/linear-1.c | 42 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/gomp/linear-1.C | 48 |
7 files changed, 121 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog.gomp b/gcc/c/ChangeLog.gomp index a76b0a4e36d..2ccb8ccf249 100644 --- a/gcc/c/ChangeLog.gomp +++ b/gcc/c/ChangeLog.gomp @@ -1,3 +1,8 @@ +2015-10-13 Jakub Jelinek <jakub@redhat.com> + + * c-typeck.c (c_finish_omp_clauses): Disallow modifiers on simd/for + constructs. + 2015-10-09 Jakub Jelinek <jakub@redhat.com> * c-typeck.c (handle_omp_array_sections_1): Diagnose negative diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 00fe31ccdc7..459c652d769 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -12470,6 +12470,14 @@ c_finish_omp_clauses (tree clauses, bool is_omp, bool declare_simd) if (!declare_simd) need_implicitly_determined = true; t = OMP_CLAUSE_DECL (c); + if (!declare_simd + && OMP_CLAUSE_LINEAR_KIND (c) != OMP_CLAUSE_LINEAR_DEFAULT) + { + error_at (OMP_CLAUSE_LOCATION (c), + "modifier should not be specified in %<linear%> " + "clause on %<simd%> or %<for%> constructs"); + OMP_CLAUSE_LINEAR_KIND (c) = OMP_CLAUSE_LINEAR_DEFAULT; + } if (!INTEGRAL_TYPE_P (TREE_TYPE (t)) && TREE_CODE (TREE_TYPE (t)) != POINTER_TYPE) { diff --git a/gcc/cp/ChangeLog.gomp b/gcc/cp/ChangeLog.gomp index 25600ff0388..a08c43878bb 100644 --- a/gcc/cp/ChangeLog.gomp +++ b/gcc/cp/ChangeLog.gomp @@ -1,3 +1,8 @@ +2015-10-13 Jakub Jelinek <jakub@redhat.com> + + * semantics.c (finish_omp_clauses): Disallow modifiers on simd/for + constructs. + 2015-10-09 Jakub Jelinek <jakub@redhat.com> * semantics.c (handle_omp_array_sections_1): Diagnose negative diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 6992ff49811..e49f1fa1b12 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5725,6 +5725,14 @@ finish_omp_clauses (tree clauses, bool allow_fields, bool declare_simd) case OMP_CLAUSE_LINEAR: field_ok = allow_fields; t = OMP_CLAUSE_DECL (c); + if (!declare_simd + && OMP_CLAUSE_LINEAR_KIND (c) != OMP_CLAUSE_LINEAR_DEFAULT) + { + error_at (OMP_CLAUSE_LOCATION (c), + "modifier should not be specified in %<linear%> " + "clause on %<simd%> or %<for%> constructs"); + OMP_CLAUSE_LINEAR_KIND (c) = OMP_CLAUSE_LINEAR_DEFAULT; + } if ((VAR_P (t) || TREE_CODE (t) == PARM_DECL) && !type_dependent_expression_p (t)) { diff --git a/gcc/testsuite/ChangeLog.gomp b/gcc/testsuite/ChangeLog.gomp index 3a7b3e84d01..be65a57f1cc 100644 --- a/gcc/testsuite/ChangeLog.gomp +++ b/gcc/testsuite/ChangeLog.gomp @@ -1,3 +1,8 @@ +2015-10-13 Jakub Jelinek <jakub@redhat.com> + + * c-c++-common/gomp/linear-1.c: New test. + * g++.dg/gomp/linear-1.C: New test. + 2015-10-09 Jakub Jelinek <jakub@redhat.com> * c-c++-common/gomp/depend-4.c (main): Add tests for negative diff --git a/gcc/testsuite/c-c++-common/gomp/linear-1.c b/gcc/testsuite/c-c++-common/gomp/linear-1.c new file mode 100644 index 00000000000..4557e22cb4f --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/linear-1.c @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +int i; + +#pragma omp declare simd linear (val (x) : 1) linear (y : 2) +int bar (int x, int y, int z); + +void +foo (int x, int y) +{ + #pragma omp simd linear (i: 3) + for (i = 0; i < 33; i += 3) + ; + #pragma omp simd linear (val (i): 3) /* { dg-error "modifier should not be specified in" } */ + for (i = 0; i < 33; i += 3) + ; + #pragma omp simd linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp simd linear (val (x): y + 1) /* { dg-error "modifier should not be specified in" } */ + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (val (x): y + 1) /* { dg-error "modifier should not be specified in" } */ + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (i: 3) + for (i = 0; i < 33; i += 3) + ; + #pragma omp for simd linear (val (i): 3) /* { dg-error "modifier should not be specified in" } */ + for (i = 0; i < 33; i += 3) + ; + #pragma omp for simd linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (val (x): y + 1) /* { dg-error "modifier should not be specified in" } */ + for (i = 0; i < 10; i++) + x += y + 1; +} diff --git a/gcc/testsuite/g++.dg/gomp/linear-1.C b/gcc/testsuite/g++.dg/gomp/linear-1.C new file mode 100644 index 00000000000..68d58fee59f --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/linear-1.C @@ -0,0 +1,48 @@ +// { dg-do compile } +// { dg-options "-fopenmp" } + +int i; + +#pragma omp declare simd linear (ref (x) : 1) linear (uval (y) : 2) +int bar (int &x, int &y, int z); + +void +foo (int &x, int &y) +{ + #pragma omp simd linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp simd linear (val (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp simd linear (ref (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp simd linear (uval (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (val (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (ref (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for linear (uval (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (x: y + 1) + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (val (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (ref (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; + #pragma omp for simd linear (uval (x): y + 1) // { dg-error "modifier should not be specified in" } + for (i = 0; i < 10; i++) + x += y + 1; +} |