Commit cc8b343d by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/37530 (ICE with invalid catch)

	PR c++/37530
	* gimplify.c (gimplify_expr) <case TRY_CATCH_EXPR>: Don't create
	GIMPLE_TRY if cleanup sequence is empty.

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

From-SVN: r140401
parent 326a4d4e
2008-09-16 Jakub Jelinek <jakub@redhat.com>
PR c++/37530
* gimplify.c (gimplify_expr) <case TRY_CATCH_EXPR>: Don't create
GIMPLE_TRY if cleanup sequence is empty.
2008-09-16 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR middle-end/37263
......
......@@ -6586,6 +6586,13 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
eval = cleanup = NULL;
gimplify_and_add (TREE_OPERAND (*expr_p, 0), &eval);
gimplify_and_add (TREE_OPERAND (*expr_p, 1), &cleanup);
/* Don't create bogus GIMPLE_TRY with empty cleanup. */
if (gimple_seq_empty_p (cleanup))
{
gimple_seq_add_seq (pre_p, eval);
ret = GS_ALL_DONE;
break;
}
try_ = gimple_build_try (eval, cleanup,
TREE_CODE (*expr_p) == TRY_FINALLY_EXPR
? GIMPLE_TRY_FINALLY
......
2008-09-16 Jakub Jelinek <jakub@redhat.com>
PR c++/37530
* g++.dg/parse/crash48.C: New test.
PR c++/37531
* g++.dg/parse/crash47.C: New test.
......
// PR c++/37530
// { dg-do compile }
void
foo (bool b)
{
if (b)
try { throw 0; } catch (X) { } // { dg-error "expected type-specifier before" }
}
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