public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: Don't crash on multiple results from void fn
@ 2010-12-22  6:17 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2010-12-22  6:17 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

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

This patch fixes an ice-on-invalid in the Go frontend when a program
tried to get multiple results from a function which did not return any
results.  Bootstrapped and ran Go testsuite 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: 585 bytes --]

diff -r 2e6068faea8a go/expressions.cc
--- a/go/expressions.cc	Tue Dec 21 17:21:30 2010 -0800
+++ b/go/expressions.cc	Tue Dec 21 17:24:12 2010 -0800
@@ -8816,6 +8816,12 @@
   if (fntype == NULL)
     return Type::make_error_type();
   const Typed_identifier_list* results = fntype->results();
+  if (results == NULL)
+    {
+      this->report_error(_("number of results does not match "
+			   "number of values"));
+      return Type::make_error_type();
+    }
   Typed_identifier_list::const_iterator pr = results->begin();
   for (unsigned int i = 0; i < this->index_; ++i)
     {

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

only message in thread, other threads:[~2010-12-22  1:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-22  6:17 Go patch committed: Don't crash on multiple results from void fn 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).