From d9611f55eb143d526b97b032b7169313d73515e0 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 10 Dec 2018 12:39:07 +0000 Subject: [PATCH] re PR tree-optimization/88415 (ICE: verify_gimple failed (error: dead STMT in EH table)) 2018-12-10 Richard Biener PR middle-end/88415 * gimple.c (gimple_assign_set_rhs_with_ops): Transfer EH info to a newly allocated stmt. * gcc.dg/gomp/pr88415.c: New testcase. From-SVN: r266951 --- gcc/ChangeLog | 6 ++++++ gcc/gimple.c | 13 +++++++------ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/gomp/pr88415.c | 12 ++++++++++++ 4 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/gomp/pr88415.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5f2ed0a..41591ff 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-12-10 Richard Biener + + PR middle-end/88415 + * gimple.c (gimple_assign_set_rhs_with_ops): Transfer EH + info to a newly allocated stmt. + 2018-12-10 Jerome Lambourg * config/vxworksae.h (TARGET_VXWORKS_HAVE_CTORS_DTORS): Define. diff --git a/gcc/gimple.c b/gcc/gimple.c index 23ccbae..3222a21 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -1729,16 +1729,15 @@ gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code, { unsigned new_rhs_ops = get_gimple_rhs_num_ops (code); gimple *stmt = gsi_stmt (*gsi); + gimple *old_stmt = stmt; /* If the new CODE needs more operands, allocate a new statement. */ if (gimple_num_ops (stmt) < new_rhs_ops + 1) { - tree lhs = gimple_assign_lhs (stmt); - gimple *new_stmt = gimple_alloc (gimple_code (stmt), new_rhs_ops + 1); - memcpy (new_stmt, stmt, gimple_size (gimple_code (stmt))); - gimple_init_singleton (new_stmt); - gsi_replace (gsi, new_stmt, false); - stmt = new_stmt; + tree lhs = gimple_assign_lhs (old_stmt); + stmt = gimple_alloc (gimple_code (old_stmt), new_rhs_ops + 1); + memcpy (stmt, old_stmt, gimple_size (gimple_code (old_stmt))); + gimple_init_singleton (stmt); /* The LHS needs to be reset as this also changes the SSA name on the LHS. */ @@ -1752,6 +1751,8 @@ gimple_assign_set_rhs_with_ops (gimple_stmt_iterator *gsi, enum tree_code code, gimple_assign_set_rhs2 (stmt, op2); if (new_rhs_ops > 2) gimple_assign_set_rhs3 (stmt, op3); + if (stmt != old_stmt) + gsi_replace (gsi, stmt, true); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2306622..ff2d5b5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-12-10 Richard Biener + + PR middle-end/88415 + * gcc.dg/gomp/pr88415.c: New testcase. + 2018-12-10 Eric Botcazou * c-c++-common/patchable_function_entry-decl.c: Pass -mcpu=gr6 for diff --git a/gcc/testsuite/gcc.dg/gomp/pr88415.c b/gcc/testsuite/gcc.dg/gomp/pr88415.c new file mode 100644 index 0000000..eeb00f0 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr88415.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-fexceptions -fnon-call-exceptions -fopenmp -fsignaling-nans -funsafe-math-optimizations -fno-associative-math" } */ + +void +lx (_Complex int *yn) +{ + int mj; + +#pragma omp for + for (mj = 0; mj < 1; ++mj) + yn[mj] += 1; +} -- 2.7.4