aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-01-24 20:16:21 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-01-24 20:16:21 +0100
commite21c4491293763b5dc61664b6a2292c3a8fc8ae1 (patch)
treed77ff218bb91e25d21ecb7327c17b83a0538d9bb /gcc/c
parentacac773aaa0434993650c079685a41b78121a619 (diff)
downloadgcc-e21c4491293763b5dc61664b6a2292c3a8fc8ae1.zip
gcc-e21c4491293763b5dc61664b6a2292c3a8fc8ae1.tar.gz
gcc-e21c4491293763b5dc61664b6a2292c3a8fc8ae1.tar.bz2
re PR c++/88976 (ICE in fold_convert_loc, at fold-const.c:2552)
PR c++/88976 * c-typeck.c (c_finish_omp_cancel): Diagnose more than one if on #pragma omp cancel with different modifiers. * semantics.c (finish_omp_cancel): Diagnose more than one if on #pragma omp cancel with different modifiers. Use maybe_convert_cond when not in template or build_x_binary_op otherwise. * c-c++-common/gomp/cancel-2.c: New test. * gcc.dg/gomp/cancel-1.c: New test. * g++.dg/gomp/cancel-1.C: New test. * g++.dg/gomp/cancel-2.C: New test. * g++.dg/gomp/cancel-3.C: New test. From-SVN: r268245
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-typeck.c12
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index fe83d69..32c77f9 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,9 @@
+2019-01-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/88976
+ * c-typeck.c (c_finish_omp_cancel): Diagnose more than one if
+ on #pragma omp cancel with different modifiers.
+
2019-01-18 H.J. Lu <hongjiu.lu@intel.com>
PR c/51628
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index cbd612c..4811200 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -12766,6 +12766,18 @@ c_finish_omp_cancel (location_t loc, tree clauses)
&& OMP_CLAUSE_IF_MODIFIER (ifc) != VOID_CST)
error_at (OMP_CLAUSE_LOCATION (ifc),
"expected %<cancel%> %<if%> clause modifier");
+ else
+ {
+ tree ifc2 = omp_find_clause (OMP_CLAUSE_CHAIN (ifc), OMP_CLAUSE_IF);
+ if (ifc2 != NULL_TREE)
+ {
+ gcc_assert (OMP_CLAUSE_IF_MODIFIER (ifc) == VOID_CST
+ && OMP_CLAUSE_IF_MODIFIER (ifc2) != ERROR_MARK
+ && OMP_CLAUSE_IF_MODIFIER (ifc2) != VOID_CST);
+ error_at (OMP_CLAUSE_LOCATION (ifc2),
+ "expected %<cancel%> %<if%> clause modifier");
+ }
+ }
tree type = TREE_TYPE (OMP_CLAUSE_IF_EXPR (ifc));
ifc = fold_build2_loc (OMP_CLAUSE_LOCATION (ifc), NE_EXPR,