diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-18 11:16:07 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-18 11:16:07 +0000 |
commit | a09ce8264aead81033a86bff59c5d2773cf931f5 (patch) | |
tree | 0a5d4bea47812ee107c666286ff567e90ad089ca /gcc/gimplify.c | |
parent | 3e055d82d9f2fea78f7c7287c09d1cbfacd7f514 (diff) | |
download | gcc-a09ce8264aead81033a86bff59c5d2773cf931f5.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149770 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 884d00f0722..dc8d0c089a4 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 %<void%>"); + ret = GS_ERROR; + } + /* Try this again in case gimplification exposed something. */ if (ret != GS_ERROR) { |