re PR tree-optimization/78777 (ICE in mark_reachable_handlers, at tree-eh.c:3823...
authorJakub Jelinek <jakub@redhat.com>
Mon, 12 Dec 2016 22:02:52 +0000 (23:02 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 12 Dec 2016 22:02:52 +0000 (23:02 +0100)
PR tree-optimization/78777
* gimple-ssa-strength-reduction.c (create_add_on_incoming_edge,
insert_initializers): Use stmt_ends_bb_p instead of is_ctrl_stmt.

* g++.dg/torture/pr78777.C: New test.

From-SVN: r243584

gcc/ChangeLog
gcc/gimple-ssa-strength-reduction.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr78777.C [new file with mode: 0644]

index 50a9cf753769557347f1222a1ae4e997828fa688..95e896637adf8f086834f70bdf6deb076d95b940 100644 (file)
@@ -1,5 +1,9 @@
 2016-12-12  Jakub Jelinek  <jakub@redhat.com>
 
+       PR tree-optimization/78777
+       * gimple-ssa-strength-reduction.c (create_add_on_incoming_edge,
+       insert_initializers): Use stmt_ends_bb_p instead of is_ctrl_stmt.
+
        PR other/78766
        * opt-functions.awk (opt_args): Use [{] instead of { in regexps.
        Formatting fix.
index 21dcbb050568fce9c791490998fdaf1c4f4429e2..ba82a2004490895cc6019e2d477ad3819c17aa1e 100644 (file)
@@ -2253,7 +2253,7 @@ create_add_on_incoming_edge (slsr_cand_t c, tree basis_name,
   insert_bb = single_succ_p (e->src) ? e->src : split_edge (e);
   gsi = gsi_last_bb (insert_bb);
 
-  if (!gsi_end_p (gsi) && is_ctrl_stmt (gsi_stmt (gsi)))
+  if (!gsi_end_p (gsi) && stmt_ends_bb_p (gsi_stmt (gsi)))
     {
       gsi_insert_before (&gsi, new_stmt, GSI_SAME_STMT);
       if (cast_stmt)
@@ -3243,7 +3243,7 @@ insert_initializers (slsr_cand_t c)
          gimple *basis_stmt = lookup_cand (c->basis)->cand_stmt;
          location_t loc = gimple_location (basis_stmt);
 
-         if (!gsi_end_p (gsi) && is_ctrl_stmt (gsi_stmt (gsi)))
+         if (!gsi_end_p (gsi) && stmt_ends_bb_p (gsi_stmt (gsi)))
            {
              if (cast_stmt)
                {
index 71a6e2a53dda7d0fafdec2c78a553f81fa21bbe7..b4eea7231f3e39b6caeb789f0c5efd9156da909b 100644 (file)
@@ -1,3 +1,8 @@
+2016-12-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/78777
+       * g++.dg/torture/pr78777.C: New test.
+
 2016-12-12  Martin Sebor  <msebor@redhat.com>
 
        PR middle-end/78622
diff --git a/gcc/testsuite/g++.dg/torture/pr78777.C b/gcc/testsuite/g++.dg/torture/pr78777.C
new file mode 100644 (file)
index 0000000..451289e
--- /dev/null
@@ -0,0 +1,29 @@
+// PR tree-optimization/78777
+
+void bar (char);
+struct C { char b; };
+struct H { char d[5]; int e; C *f[4]; int g[10]; };
+void baz (C *, unsigned char *, int);
+unsigned char j[10];
+
+void
+foo (H *o, int p, unsigned char *q, int r, char n, H *b)
+{
+  for (int m = 0; m < o->e; m++)
+    {
+      if (o->f[m] || o->g[m])
+       continue;
+      try
+       {
+         baz (o->f[m], j, 5);
+         if (p)
+           baz (o->f[m], q, r);
+       }
+      catch (int)
+       {
+         C a = *o->f[m];
+         if (b)
+           bar (n & a.b);
+       }
+    }
+}