From 33922890f647d590f0450638c03ff1673022b662 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Sat, 18 Jul 2009 11:16:07 +0000 Subject: [PATCH] re PR c/40787 (ICE: verify_gimple failed in gcc.dg/pr35899.c) 2009-07-18 Richard Guenther PR c/40787 * gimplify.c (gimplify_call_expr): Reject code using results from functions returning void. * gcc.dg/pr35899.c: Adjust. From-SVN: r149770 --- gcc/ChangeLog | 6 ++++++ gcc/gimplify.c | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr35899.c | 4 +++- 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 43b5cc6fb109..1c09316ab153 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-07-18 Richard Guenther + + PR c/40787 + * gimplify.c (gimplify_call_expr): Reject code using results from + functions returning void. + 2009-07-18 Richard Sandiford * doc/md.texi: Document the new PowerPC "es" constraint. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 884d00f07220..dc8d0c089a47 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -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 %"); + ret = GS_ERROR; + } + /* Try this again in case gimplification exposed something. */ if (ret != GS_ERROR) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5f08b2d963c4..e13f10fdddda 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-07-18 Richard Guenther + + PR c/40787 + * gcc.dg/pr35899.c: Adjust. + 2009-07-18 Richard Sandiford * gcc.target/powerpc/asm-es-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr35899.c b/gcc/testsuite/gcc.dg/pr35899.c index 4ce4ac589f1b..0dc4ffaa3171 100644 --- a/gcc/testsuite/gcc.dg/pr35899.c +++ b/gcc/testsuite/gcc.dg/pr35899.c @@ -5,7 +5,7 @@ int foo (void) { - int a = bar (); /* { dg-message "note: previous implicit declaration" } */ + int a = bar (); /* { dg-error "returning 'void'" } */ return a; } @@ -13,3 +13,5 @@ void bar (void) /* { dg-warning "conflicting types for" } */ { } + +/* { dg-message "note: previous implicit declaration" "" { target *-*-* } 8 } */ -- 2.47.2