aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-05-26 21:12:27 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-05-26 21:12:27 +0200
commit7211a0975c25b21baa8e31ebc2946f4d6d136fed (patch)
tree7776f4844e8b9eae6129a9d2d8616ce108d89a5b /gcc/cp
parentcac177cfad2b48c29870caeb0af51d7cee645fae (diff)
downloadgcc-7211a0975c25b21baa8e31ebc2946f4d6d136fed.zip
gcc-7211a0975c25b21baa8e31ebc2946f4d6d136fed.tar.gz
gcc-7211a0975c25b21baa8e31ebc2946f4d6d136fed.tar.bz2
c-parser.c (c_parser_omp_clause_schedule): Warn if OMP_CLAUSE_SCHEDULE_CHUNK_EXPR is known not to be positive.
* c-parser.c (c_parser_omp_clause_schedule): Warn if OMP_CLAUSE_SCHEDULE_CHUNK_EXPR is known not to be positive. * semantics.c (finish_omp_clauses) <case OMP_CLAUSE_SCHEDULE>: Warn if OMP_CLAUSE_SCHEDULE_CHUNK_EXPR is known not to be positive. * openmp.c (resolve_omp_clauses): Warn if chunk_size is known not to be positive. * c-c++-common/gomp/schedule-1.c: New test. * gfortran.dg/gomp/schedule-1.f90: New test. * testsuite/libgomp.c/doacross-1.c (main): Use schedule(static) instead of invalid schedule(static, 0). * testsuite/libgomp.c/doacross-2.c (main): Likewise. From-SVN: r236793
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/semantics.c11
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ff5d8f4..770f817 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2016-05-26 Jakub Jelinek <jakub@redhat.com>
+
+ * semantics.c (finish_omp_clauses) <case OMP_CLAUSE_SCHEDULE>: Warn
+ if OMP_CLAUSE_SCHEDULE_CHUNK_EXPR is known not to be positive.
+
2016-05-26 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/70822
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 0cef867..253d31a 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -6319,6 +6319,17 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
break;
}
}
+ else
+ {
+ t = maybe_constant_value (t);
+ if (TREE_CODE (t) == INTEGER_CST
+ && tree_int_cst_sgn (t) != 1)
+ {
+ warning_at (OMP_CLAUSE_LOCATION (c), 0,
+ "chunk size value must be positive");
+ t = integer_one_node;
+ }
+ }
t = fold_build_cleanup_point_expr (TREE_TYPE (t), t);
}
OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = t;