re PR middle-end/57036 (ice in update_ssa_across_abnormal_edges)
authorRichard Biener <rguenther@suse.de>
Tue, 23 Apr 2013 14:36:02 +0000 (14:36 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 23 Apr 2013 14:36:02 +0000 (14:36 +0000)
2013-04-23  Richard Biener  <rguenther@suse.de>

PR middle-end/57036
* tree-inline.c (copy_edges_for_bb): Add can_make_abnormal_goto
parameter, only add abnormal goto edges from the copied body
if the call could perform abnormal gotos.
(copy_cfg_body): Adjust.

* gcc.dg/torture/pr57036-1.c: New testcase.
* gcc.dg/torture/pr57036-2.c: Likewise.

From-SVN: r198192

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr57036-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr57036-2.c [new file with mode: 0644]
gcc/tree-inline.c

index 307d38911a882384554367492d9a3270e4058b99..ca931ae03749e6bfedb02da258f5b5477aeb9e8c 100644 (file)
@@ -1,3 +1,11 @@
+2013-04-23  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/57036
+       * tree-inline.c (copy_edges_for_bb): Add can_make_abnormal_goto
+       parameter, only add abnormal goto edges from the copied body
+       if the call could perform abnormal gotos.
+       (copy_cfg_body): Adjust.
+
 2013-04-23  Sofiane Naci  <sofiane.naci@arm.com>
 
        * config/aarch64/aarch64.md (*mov<mode>_aarch64): Add simd attribute.
index a54279a598d3e5fc214324c4bd4d85ec336f6a81..a9c869490c8ab7cc34215ba326dfcf40e60a68a8 100644 (file)
@@ -1,3 +1,9 @@
+2013-04-23  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/57036
+       * gcc.dg/torture/pr57036-1.c: New testcase.
+       * gcc.dg/torture/pr57036-2.c: Likewise.
+
 2013-04-23  Sofiane Naci  <sofiane.naci@arm.com>
 
        * gcc.target/aarch64/scalar-mov.c: New testcase.
diff --git a/gcc/testsuite/gcc.dg/torture/pr57036-1.c b/gcc/testsuite/gcc.dg/torture/pr57036-1.c
new file mode 100644 (file)
index 0000000..5aa63bd
--- /dev/null
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+extern void g (void);
+extern __inline __attribute__ ((__always_inline__,__leaf__))
+f ()
+{
+  g ();
+}
+struct __jmp_buf_tag *b;
+int jpgDecode_convert (unsigned i)
+{
+  if (i != 0)
+    f ();
+  read_buf_open ();
+  return _setjmp (b);
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr57036-2.c b/gcc/testsuite/gcc.dg/torture/pr57036-2.c
new file mode 100644 (file)
index 0000000..25de5cd
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+
+int j_;
+int jpgDecode_convert (unsigned i)
+{
+  __label__ label;
+  int j;
+
+  inline void __attribute__((always_inline,leaf)) f(void)
+    {
+      g();
+    }
+
+  void __attribute__((noinline)) read_buf_open (void)
+    {
+      goto label;
+    }
+
+  if (i != 0)
+    f ();
+  j = j_;
+  read_buf_open ();
+label:
+  return j;
+}
index b94ba10ee0b15b49b225d58eeab4c02d8b50aa12..7fa0245d16cced68f25fd8211892e88494218cd4 100644 (file)
@@ -1866,7 +1866,8 @@ update_ssa_across_abnormal_edges (basic_block bb, basic_block ret_bb,
    debug stmts are left after a statement that must end the basic block.  */
 
 static bool
-copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb)
+copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb,
+                  bool can_make_abnormal_goto)
 {
   basic_block new_bb = (basic_block) bb->aux;
   edge_iterator ei;
@@ -1921,7 +1922,11 @@ copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb)
          into a COMPONENT_REF which doesn't.  If the copy
          can throw, the original could also throw.  */
       can_throw = stmt_can_throw_internal (copy_stmt);
-      nonlocal_goto = stmt_can_make_abnormal_goto (copy_stmt);
+      /* If the call we inline cannot make abnormal goto do not add
+         additional abnormal edges but only retain those already present
+        in the original function body.  */
+      nonlocal_goto
+       = can_make_abnormal_goto && stmt_can_make_abnormal_goto (copy_stmt);
 
       if (can_throw || nonlocal_goto)
        {
@@ -2270,10 +2275,13 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale,
   last = last_basic_block;
 
   /* Now that we've duplicated the blocks, duplicate their edges.  */
+  bool can_make_abormal_goto
+    = id->gimple_call && stmt_can_make_abnormal_goto (id->gimple_call);
   FOR_ALL_BB_FN (bb, cfun_to_copy)
     if (!blocks_to_copy
         || (bb->index > 0 && bitmap_bit_p (blocks_to_copy, bb->index)))
-      need_debug_cleanup |= copy_edges_for_bb (bb, count_scale, exit_block_map);
+      need_debug_cleanup |= copy_edges_for_bb (bb, count_scale, exit_block_map,
+                                              can_make_abormal_goto);
 
   if (new_entry)
     {