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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155762
138bc75d-0d04-0410-961f-
82ee72b054a4
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
PR debug/42395
* tree-vect-loop-manip.c (adjust_info): New type.
/* 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
{
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
PR debug/42395
* gcc.dg/vect/pr42604.c: New.
--- /dev/null
+/* 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 ())
+ ;
+}
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;
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)),