Commit 19c37faa by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/83634 (ICE in useless_type_conversion_p, at gimple-expr.c:86)

	PR c++/83634
	* cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
	error_mark_node, return error_mark_node.

	* g++.dg/parse/pr83634.C: New test.

From-SVN: r256174
parent 8987beac
2018-01-03 Jakub Jelinek <jakub@redhat.com>
PR c++/83634
* cp-gimplify.c (cp_fold) <case NOP_EXPR>: If the operand folds to
error_mark_node, return error_mark_node.
Update copyright years.
2018-01-02 Jakub Jelinek <jakub@redhat.com>
......
......@@ -2112,7 +2112,20 @@ cp_fold (tree x)
case NON_LVALUE_EXPR:
if (VOID_TYPE_P (TREE_TYPE (x)))
return x;
{
/* This is just to make sure we don't end up with casts to
void from error_mark_node. If we just return x, then
cp_fold_r might fold the operand into error_mark_node and
leave the conversion in the IR. STRIP_USELESS_TYPE_CONVERSION
during gimplification doesn't like such casts.
Don't create a new tree if op0 != TREE_OPERAND (x, 0), the
folding of the operand should be in the caches and if in cp_fold_r
it will modify it in place. */
op0 = cp_fold (TREE_OPERAND (x, 0));
if (op0 == error_mark_node)
x = error_mark_node;
break;
}
loc = EXPR_LOCATION (x);
op0 = cp_fold_maybe_rvalue (TREE_OPERAND (x, 0), rval_ops);
......
2018-01-03 Jakub Jelinek <jakub@redhat.com>
PR c++/83634
* g++.dg/parse/pr83634.C: New test.
2018-01-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/83664
......
// PR c++/83634
// { dg-do compile }
void
foo ()
{
const int x = fn (); // { dg-error "was not declared in this scope" }
short n;
for (n = x; n < 100; ++n)
;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment