re PR c++/88984 (ICE in genericize_switch_stmt, at cp/cp-gimplify.c:377)

PR c++/88984
	* cp-gimplify.c (genericize_switch_stmt): Move cond genericization
	before the begin_bc_block call.

	* c-c++-common/pr88984.c: New test.

From-SVN: r268187
This commit is contained in:
Jakub Jelinek 2019-01-23 15:39:43 +01:00 committed by Jakub Jelinek
parent ef192ae1b6
commit d0f2db2316
4 changed files with 34 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2019-01-23 Jakub Jelinek <jakub@redhat.com>
PR c++/88984
* cp-gimplify.c (genericize_switch_stmt): Move cond genericization
before the begin_bc_block call.
2019-01-21 Jason Merrill <jason@redhat.com>
PR c++/87893 - constexpr ctor ICE on ARM.

View File

@ -356,16 +356,17 @@ genericize_switch_stmt (tree *stmt_p, int *walk_subtrees, void *data)
tree break_block, body, cond, type;
location_t stmt_locus = EXPR_LOCATION (stmt);
break_block = begin_bc_block (bc_break, stmt_locus);
body = SWITCH_STMT_BODY (stmt);
if (!body)
body = build_empty_stmt (stmt_locus);
cond = SWITCH_STMT_COND (stmt);
type = SWITCH_STMT_TYPE (stmt);
cp_walk_tree (&body, cp_genericize_r, data, NULL);
cp_walk_tree (&cond, cp_genericize_r, data, NULL);
break_block = begin_bc_block (bc_break, stmt_locus);
cp_walk_tree (&body, cp_genericize_r, data, NULL);
cp_walk_tree (&type, cp_genericize_r, data, NULL);
*walk_subtrees = 0;

View File

@ -1,3 +1,8 @@
2019-01-23 Jakub Jelinek <jakub@redhat.com>
PR c++/88984
* c-c++-common/pr88984.c: New test.
2019-01-23 Richard Biener <rguenther@suse.de>
PR tree-optimization/89008

View File

@ -0,0 +1,19 @@
/* PR c++/88984 */
/* { dg-do run } */
void
foo (int x, int y)
{
while (x > 0)
switch (({ if (y) break; y; }))
{
case 2: x = 0;
}
}
int
main ()
{
foo (1, 1);
return 0;
}