]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/42363 (ICE: verify_flow_info failed for gcc.c-torture/compile/pr3791...
authorAlexandre Oliva <aoliva@redhat.com>
Sat, 9 Jan 2010 14:40:59 +0000 (14:40 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Sat, 9 Jan 2010 14:40:59 +0000 (14:40 +0000)
gcc/ChangeLog:
PR middle-end/42363
* gimplify.c (gimplify_modify_expr): Drop lhs on noreturn calls.
* tree-cfg.c (is_ctrl_altering_stmt): Don't compute flags twice.
(verify_gimple_call): Reject LHS in noreturn calls.
gcc/testsuite/ChangeLog:
PR middle-end/42363
* gcc.dg/torture/pr42363.c: New.

From-SVN: r155762

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr42363.c [new file with mode: 0644]
gcc/tree-cfg.c

index b5c240789f7f5d36b9b8cd89a01ff957f09c9b02..2e66d7e72d84e20096c2d6771ac22aa812dca114 100644 (file)
@@ -1,3 +1,10 @@
+2010-01-09  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR middle-end/42363
+       * gimplify.c (gimplify_modify_expr): Drop lhs on noreturn calls.
+       * tree-cfg.c (is_ctrl_altering_stmt): Don't compute flags twice.
+       (verify_gimple_call): Reject LHS in noreturn calls.
+
 2010-01-09  Alexandre Oliva  <aoliva@redhat.com>
 
        PR debug/42604
index a3c6834beff70b8ded0e5f8a50d829af8f81626e..e09cb3e429be2df902dafa619895ea578d7a159b 100644 (file)
@@ -4407,7 +4407,8 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
       /* Since the RHS is a CALL_EXPR, we need to create a GIMPLE_CALL
         instead of a GIMPLE_ASSIGN.  */
       assign = gimple_build_call_from_tree (*from_p);
-      gimple_call_set_lhs (assign, *to_p);
+      if (!gimple_call_noreturn_p (assign))
+       gimple_call_set_lhs (assign, *to_p);
     }
   else
     {
index 08c6bffc6fe41d5588efef82b05c28325a64ab46..83535c06b0e36b0e86a114aa0a0046a7571fdc2e 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-09  Alexandre Oliva  <aoliva@redhat.com>
+
+       PR middle-end/42363
+       * gcc.dg/torture/pr42363.c: New.
+
 2010-01-09  Alexandre Oliva  <aoliva@redhat.com>
 
        PR debug/42604
diff --git a/gcc/testsuite/gcc.dg/torture/pr42363.c b/gcc/testsuite/gcc.dg/torture/pr42363.c
new file mode 100644 (file)
index 0000000..9c9da13
--- /dev/null
@@ -0,0 +1,84 @@
+/* PR middle-end/pr42363, extended from the test for PR middle-end/37913.  */
+/* { dg-do compile } */
+/* { dg-options "-g" } */
+
+void foo (void) __attribute__ ((noreturn));
+
+static int __attribute__ ((noreturn))
+bar (void)
+{
+  foo ();
+}
+
+int
+baz (void)
+{
+  int i = bar ();
+  return i + 1;
+}
+
+int fooz (void) __attribute__ ((noreturn));
+
+static int __attribute__ ((noreturn))
+bart (void)
+{
+  return fooz (); /* { dg-warning "noreturn" } */
+}
+
+int bazr (void)
+{
+  int i = bart ();
+  return i + 1;
+}
+
+static inline int
+bard (void)
+{
+  return fooz ();
+}
+
+int bizr (void)
+{
+  int i, j;
+
+  i = j = bard ();
+
+  return i + 1;
+}
+
+/* This might be regarded as pure and folded, rather than inlined.
+   It's pure evil.  */
+static int __attribute__ ((pure, const, noreturn))
+barf (void)
+{
+} /* { dg-warning "does return" } */
+
+static int __attribute__ ((pure, const))
+bark (void)
+{
+  barf ();
+}
+
+int buzr (void)
+{
+  int i, j;
+
+  i = j = bark () + bark ();
+
+  return i + 1;
+}
+
+int buzt (void)
+{
+  int i, j;
+
+  i = j = barf () + barf ();
+
+  return i + 1;
+}
+
+void bust (void)
+{
+  while (barf ())
+    ;
+}
index 36e518c98820cc1afd60724b99ccfd2445494634..b6e9006072c154abe85c50734fa442d1c216a33a 100644 (file)
@@ -2230,7 +2230,7 @@ is_ctrl_altering_stmt (gimple t)
          return true;
 
        /* A call also alters control flow if it does not return.  */
-       if (gimple_call_flags (t) & ECF_NORETURN)
+       if (flags & ECF_NORETURN)
          return true;
       }
       break;
@@ -2963,6 +2963,12 @@ verify_gimple_call (gimple stmt)
       return true;
     }
 
+  if (gimple_call_lhs (stmt) && gimple_call_noreturn_p (stmt))
+    {
+      error ("LHS in noreturn call");
+      return true;
+    }
+
   fntype = TREE_TYPE (TREE_TYPE (fn));
   if (gimple_call_lhs (stmt)
       && !useless_type_conversion_p (TREE_TYPE (gimple_call_lhs (stmt)),