diff options
author | Jakub Jelinek <jakub@redhat.com> | 2016-05-26 21:12:27 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2016-05-26 21:12:27 +0200 |
commit | 7211a0975c25b21baa8e31ebc2946f4d6d136fed (patch) | |
tree | 7776f4844e8b9eae6129a9d2d8616ce108d89a5b /gcc/c | |
parent | cac177cfad2b48c29870caeb0af51d7cee645fae (diff) | |
download | gcc-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/c')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 15 |
2 files changed, 19 insertions, 1 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index f3bb0e9..f7d1a6d 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2016-05-26 Jakub Jelinek <jakub@redhat.com> + + * c-parser.c (c_parser_omp_clause_schedule): Warn if + OMP_CLAUSE_SCHEDULE_CHUNK_EXPR is known not to be positive. + 2016-05-25 Marek Polacek <polacek@redhat.com> PR c/71265 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 1cf4fb4..fda2df8 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -12128,7 +12128,20 @@ c_parser_omp_clause_schedule (c_parser *parser, tree list) "schedule %<auto%> does not take " "a %<chunk_size%> parameter"); else if (TREE_CODE (TREE_TYPE (t)) == INTEGER_TYPE) - OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = t; + { + /* Attempt to statically determine when the number isn't + positive. */ + tree s = fold_build2_loc (loc, LE_EXPR, boolean_type_node, t, + build_int_cst (TREE_TYPE (t), 0)); + protected_set_expr_location (s, loc); + if (s == boolean_true_node) + { + warning_at (loc, 0, + "chunk size value must be positive"); + t = integer_one_node; + } + OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = t; + } else c_parser_error (parser, "expected integer expression"); |