diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-01-24 20:16:21 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-01-24 20:16:21 +0100 |
commit | e21c4491293763b5dc61664b6a2292c3a8fc8ae1 (patch) | |
tree | d77ff218bb91e25d21ecb7327c17b83a0538d9bb /gcc/cp | |
parent | acac773aaa0434993650c079685a41b78121a619 (diff) | |
download | gcc-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/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 23 |
2 files changed, 27 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 58acbf0..99d43c9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2019-01-24 Jakub Jelinek <jakub@redhat.com> + + PR c++/88976 + * 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. + 2019-01-23 Marek Polacek <polacek@redhat.com> PR c++/88757 - qualified name treated wrongly as type. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index e654750..7219139 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -9055,11 +9055,26 @@ finish_omp_cancel (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, - boolean_type_node, OMP_CLAUSE_IF_EXPR (ifc), - build_zero_cst (type)); + if (!processing_template_decl) + ifc = maybe_convert_cond (OMP_CLAUSE_IF_EXPR (ifc)); + else + ifc = build_x_binary_op (OMP_CLAUSE_LOCATION (ifc), NE_EXPR, + OMP_CLAUSE_IF_EXPR (ifc), ERROR_MARK, + integer_zero_node, ERROR_MARK, + NULL, tf_warning_or_error); } else ifc = boolean_true_node; |