re PR c++/78051 (error: dead STMT in EH table when using -O2)
authorRichard Biener <rguenther@suse.de>
Fri, 21 Oct 2016 07:07:06 +0000 (07:07 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 21 Oct 2016 07:07:06 +0000 (07:07 +0000)
2016-10-21  Richard Biener  <rguenther@suse.de>

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr78051.C [new file with mode: 0644]
gcc/tree-vrp.c

index bc1d9d1a26c8592ef32ce8973521cc7954d21a56..73370949f369326fe440d6eac60b43338662a088 100644 (file)
@@ -1,3 +1,9 @@
+2016-10-21  Richard Biener  <rguenther@suse.de>
+
+       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  <dje.gcc@gmail.com>
 
        * config/rs6000/rs6000.c (rs6000_assemble_visibility): Swap "internal"
index 22993ad8a16771e6323db3457c3daca01f1981ee..8033762d6ca2b375caaf23e0fdc215f5493b5f1c 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-21  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/78051
+       * g++.dg/torture/pr78051.C: New testcase.
+
 2016-10-20  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        * 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 (file)
index 0000000..ff28368
--- /dev/null
@@ -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);
+}
index c1750d03840f1eb3e357a18b42c1619fc8f8304d..9675ca239b4f22227593147ff8e78c4fd2691443 100644 (file)
@@ -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)
        {