mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-18 13:01:06 +08:00
re PR middle-end/42363 (ICE: verify_flow_info failed for gcc.c-torture/compile/pr37913.c -O1 -g)
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
This commit is contained in:
parent
684f25f432
commit
5de8da9b68
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
|
84
gcc/testsuite/gcc.dg/torture/pr42363.c
Normal file
84
gcc/testsuite/gcc.dg/torture/pr42363.c
Normal file
@ -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 ())
|
||||
;
|
||||
}
|
@ -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)),
|
||||
|
Loading…
x
Reference in New Issue
Block a user