backport: re PR c++/84448 (ICE with broken condition in parallel for loop)

Backported from mainline
	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.

	* g++.dg/gomp/pr84448.C: New test.

From-SVN: r258197
This commit is contained in:
Jakub Jelinek 2018-03-03 14:35:37 +01:00 committed by Jakub Jelinek
parent d3422478e5
commit fb24b1a32e
4 changed files with 37 additions and 6 deletions

View File

@ -3,6 +3,11 @@
Backported from mainline
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.

View File

@ -9071,12 +9071,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
{

View File

@ -3,6 +3,9 @@
Backported from mainline
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.

View 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 }
}