re PR c/40787 (ICE: verify_gimple failed in gcc.dg/pr35899.c)
authorRichard Guenther <rguenther@suse.de>
Sat, 18 Jul 2009 11:16:07 +0000 (11:16 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Sat, 18 Jul 2009 11:16:07 +0000 (11:16 +0000)
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

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr35899.c

index 43b5cc6fb109caef13683c6971042554c2ff76c6..1c09316ab15380e4061a74b0045e927d3e4311e1 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
        * doc/md.texi: Document the new PowerPC "es" constraint.
index 884d00f07220feaa52c48684bb7585e3c4f25fa7..dc8d0c089a47c3b15fd1ee619b57e5e5ddbbb3d4 100644 (file)
@@ -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)
     {
index 5f08b2d963c44a8398118282eceee7c253c86131..e13f10fddddae76ab6887f5e664ec91bc7f54c26 100644 (file)
@@ -1,3 +1,8 @@
+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>
 
        * gcc.target/powerpc/asm-es-1.c: New test.
index 4ce4ac589f1be8b44998e2efd357c17128d0b34f..0dc4ffaa31716a6180a3bf06dcdb96401f0b1890 100644 (file)
@@ -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 } */