From: Richard Biener Date: Fri, 21 Oct 2016 07:07:06 +0000 (+0000) Subject: re PR c++/78051 (error: dead STMT in EH table when using -O2) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a20d03c88261b7d475db7c410c1018df326c67af;p=gcc.git re PR c++/78051 (error: dead STMT in EH table when using -O2) 2016-10-21 Richard Biener PR tree-optimization/78051 * tree-vrp.c (evrp_dom_walker::before_dom_children): Update stmt and mark replaced if folding did something. * g++.dg/torture/pr78051.C: New testcase. From-SVN: r241394 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bc1d9d1a26c..73370949f36 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-10-21 Richard Biener + + PR tree-optimization/78051 + * tree-vrp.c (evrp_dom_walker::before_dom_children): Update stmt + and mark replaced if folding did something. + 2016-10-21 David Edelsohn * config/rs6000/rs6000.c (rs6000_assemble_visibility): Swap "internal" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 22993ad8a16..8033762d6ca 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-10-21 Richard Biener + + PR tree-optimization/78051 + * g++.dg/torture/pr78051.C: New testcase. + 2016-10-20 Bernd Edlinger * c-c++-common/wdate-time.c: Restored test case. diff --git a/gcc/testsuite/g++.dg/torture/pr78051.C b/gcc/testsuite/g++.dg/torture/pr78051.C new file mode 100644 index 00000000000..ff28368d4bb --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr78051.C @@ -0,0 +1,9 @@ +extern "C" { + typedef int FILE; + int *stdout; + int fputs(const char *, FILE *); +} +void print_packet() { + const char *color[]{"", "", ""}; + fputs(color[2], stdout); +} diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index c1750d03840..9675ca239b4 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -10850,7 +10850,11 @@ evrp_dom_walker::before_dom_children (basic_block bb) = replace_uses_in (stmt, op_with_constant_singleton_value_range); if (fold_stmt (&gsi, follow_single_use_edges) || did_replace) - update_stmt (gsi_stmt (gsi)); + { + stmt = gsi_stmt (gsi); + update_stmt (stmt); + did_replace = true; + } if (did_replace) {