diff options
Diffstat (limited to 'gcc/c/c-parser.c')
-rw-r--r-- | gcc/c/c-parser.c | 15 |
1 files changed, 14 insertions, 1 deletions
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"); |