re PR c++/84448 (ICE with broken condition in parallel for loop)
PR c++/84448 * parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if either operand is error_mark_node, set current.lhs to that instead of creating a binary op with error_mark_node operands. * g++.dg/gomp/pr84448.C: New test. From-SVN: r257821
This commit is contained in:
parent
897064e276
commit
4382537df8
4 changed files with 37 additions and 6 deletions
|
@ -1,5 +1,10 @@
|
|||
2018-02-19 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/84448
|
||||
* parser.c (cp_parser_binary_expression): For no_toplevel_fold_p, if
|
||||
either operand is error_mark_node, set current.lhs to that instead of
|
||||
creating a binary op with error_mark_node operands.
|
||||
|
||||
PR c++/84430
|
||||
* constexpr.c (potential_constant_expression_1): Handle OMP_SIMD.
|
||||
|
||||
|
|
|
@ -9331,12 +9331,18 @@ cp_parser_binary_expression (cp_parser* parser, bool cast_p,
|
|||
&& lookahead_prec <= current.prec
|
||||
&& sp == stack)
|
||||
{
|
||||
current.lhs
|
||||
= build_min (current.tree_type,
|
||||
TREE_CODE_CLASS (current.tree_type) == tcc_comparison
|
||||
? boolean_type_node : TREE_TYPE (current.lhs),
|
||||
current.lhs.get_value (), rhs.get_value ());
|
||||
SET_EXPR_LOCATION (current.lhs, combined_loc);
|
||||
if (current.lhs == error_mark_node || rhs == error_mark_node)
|
||||
current.lhs = error_mark_node;
|
||||
else
|
||||
{
|
||||
current.lhs
|
||||
= build_min (current.tree_type,
|
||||
TREE_CODE_CLASS (current.tree_type)
|
||||
== tcc_comparison
|
||||
? boolean_type_node : TREE_TYPE (current.lhs),
|
||||
current.lhs.get_value (), rhs.get_value ());
|
||||
SET_EXPR_LOCATION (current.lhs, combined_loc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2018-02-19 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/84448
|
||||
* g++.dg/gomp/pr84448.C: New test.
|
||||
|
||||
PR c++/84430
|
||||
* g++.dg/gomp/pr84430.C: New test.
|
||||
|
||||
|
|
17
gcc/testsuite/g++.dg/gomp/pr84448.C
Normal file
17
gcc/testsuite/g++.dg/gomp/pr84448.C
Normal file
|
@ -0,0 +1,17 @@
|
|||
// PR c++/84448
|
||||
// { dg-do compile }
|
||||
|
||||
struct A
|
||||
{
|
||||
operator int () const;
|
||||
A& operator += (int);
|
||||
A& operator ++ ();
|
||||
};
|
||||
|
||||
void
|
||||
foo (A a, A b)
|
||||
{
|
||||
#pragma omp for
|
||||
for (A i = a; i <=; ++i) // { dg-error "expected primary-expression before" }
|
||||
; // { dg-error "invalid controlling predicate" "" { target *-*-* } .-1 }
|
||||
}
|
Loading…
Add table
Reference in a new issue