Commit 33922890 by Richard Guenther Committed by Richard Biener

re PR c/40787 (ICE: verify_gimple failed in gcc.dg/pr35899.c)

2009-07-18  Richard Guenther  <rguenther@suse.de>

	PR c/40787
	* gimplify.c (gimplify_call_expr): Reject code using results from
	functions returning void.

	* gcc.dg/pr35899.c: Adjust.

From-SVN: r149770
parent 1d447995
2009-07-18 Richard Guenther <rguenther@suse.de>
PR c/40787
* gimplify.c (gimplify_call_expr): Reject code using results from
functions returning void.
2009-07-18 Richard Sandiford <r.sandiford@uk.ibm.com> 2009-07-18 Richard Sandiford <r.sandiford@uk.ibm.com>
* doc/md.texi: Document the new PowerPC "es" constraint. * doc/md.texi: Document the new PowerPC "es" constraint.
......
...@@ -2411,6 +2411,14 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) ...@@ -2411,6 +2411,14 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value)
} }
} }
/* Verify the function result. */
if (want_value && fndecl
&& VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl))))
{
error_at (loc, "using result of function returning %<void%>");
ret = GS_ERROR;
}
/* Try this again in case gimplification exposed something. */ /* Try this again in case gimplification exposed something. */
if (ret != GS_ERROR) if (ret != GS_ERROR)
{ {
......
2009-07-18 Richard Guenther <rguenther@suse.de>
PR c/40787
* gcc.dg/pr35899.c: Adjust.
2009-07-18 Richard Sandiford <r.sandiford@uk.ibm.com> 2009-07-18 Richard Sandiford <r.sandiford@uk.ibm.com>
* gcc.target/powerpc/asm-es-1.c: New test. * gcc.target/powerpc/asm-es-1.c: New test.
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
int int
foo (void) foo (void)
{ {
int a = bar (); /* { dg-message "note: previous implicit declaration" } */ int a = bar (); /* { dg-error "returning 'void'" } */
return a; return a;
} }
...@@ -13,3 +13,5 @@ void ...@@ -13,3 +13,5 @@ void
bar (void) /* { dg-warning "conflicting types for" } */ bar (void) /* { dg-warning "conflicting types for" } */
{ {
} }
/* { dg-message "note: previous implicit declaration" "" { target *-*-* } 8 } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment