aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-11-14 09:14:16 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-11-14 09:14:16 +0100
commitbedb7f045f3bc4ccf17f4b58f840c93acb821a3f (patch)
treefcccc411bdf6e64e0876f3eeeb76ff8b773b0243 /gcc/c
parentd0ec7c935f0c961b13f75c906b8621e35ce1ace5 (diff)
downloadgcc-bedb7f045f3bc4ccf17f4b58f840c93acb821a3f.zip
gcc-bedb7f045f3bc4ccf17f4b58f840c93acb821a3f.tar.gz
gcc-bedb7f045f3bc4ccf17f4b58f840c93acb821a3f.tar.bz2
c-parser.c (c_parser_omp_context_selector): Don't require score argument to fit into shwi, just to be INTEGER_CST.
* c-parser.c (c_parser_omp_context_selector): Don't require score argument to fit into shwi, just to be INTEGER_CST. Diagnose negative score. * parser.c (cp_parser_omp_context_selector): Don't require score argument to fit into shwi, just to be INTEGER_CST. Diagnose negative score. * pt.c (tsubst_attribute): Likewise. * c-c++-common/gomp/declare-variant-2.c: Add test for non-integral score and for negative score. * c-c++-common/gomp/declare-variant-3.c: Add test for zero score. * g++.dg/gomp/declare-variant-8.C: Add test for negative and zero scores. From-SVN: r278204
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog4
-rw-r--r--gcc/c/c-parser.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index b60c648..c19cf2f 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,5 +1,9 @@
2019-11-14 Jakub Jelinek <jakub@redhat.com>
+ * c-parser.c (c_parser_omp_context_selector): Don't require score
+ argument to fit into shwi, just to be INTEGER_CST. Diagnose
+ negative score.
+
* c-parser.c (c_parser_omp_context_selector): Rename
CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID.
Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 7219fc4..5e30a7f 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -19823,9 +19823,12 @@ c_parser_omp_context_selector (c_parser *parser, tree set, tree parms)
mark_exp_read (score);
score = c_fully_fold (score, false, NULL);
if (!INTEGRAL_TYPE_P (TREE_TYPE (score))
- || !tree_fits_shwi_p (score))
+ || TREE_CODE (score) != INTEGER_CST)
error_at (token->location, "score argument must be "
"constant integer expression");
+ else if (tree_int_cst_sgn (score) < 0)
+ error_at (token->location, "score argument must be "
+ "non-negative");
else
properties = tree_cons (get_identifier (" score"),
score, properties);