public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: Don't crash on erroneous go or defer statement
@ 2010-12-16  1:11 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2010-12-16  1:11 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

This patch to the Go frontend avoids crashing if a go or defer statement
is used with a bad function call.  Bootstrapped and tested on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: crash --]
[-- Type: text/x-diff, Size: 533 bytes --]

diff -r ab74f84268fd go/statements.cc
--- a/go/statements.cc	Wed Dec 15 16:01:46 2010 -0800
+++ b/go/statements.cc	Wed Dec 15 16:11:04 2010 -0800
@@ -1812,7 +1812,13 @@
 
   Call_expression* ce = this->call_->call_expression();
   Function_type* fntype = ce->get_function_type();
-  if (fntype == NULL || this->is_simple(fntype))
+  if (fntype == NULL)
+    {
+      gcc_assert(saw_errors());
+      this->set_is_error();
+      return false;
+    }
+  if (this->is_simple(fntype))
     return false;
 
   Expression* fn = ce->fn();

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-16  0:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-16  1:11 Go patch committed: Don't crash on erroneous go or defer statement Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).