* Go patch committed: Don't crash on invalid call to append
@ 2010-12-23 0:41 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2010-12-23 0:41 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 321 bytes --]
This patch to the Go frontend avoids crashing on an invalid call to
append. In some cases at check_types time there can be too many
arguments, despite an earlier call to lower_varargs. This patch avoids
a crash in that case. 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: 553 bytes --]
diff -r 9582ee2b931c go/expressions.cc
--- a/go/expressions.cc Wed Dec 22 15:45:21 2010 -0800
+++ b/go/expressions.cc Wed Dec 22 15:52:55 2010 -0800
@@ -7387,8 +7387,11 @@
this->report_error(_("not enough arguments"));
break;
}
- /* Lowering varargs should have left us with 2 arguments. */
- gcc_assert(args->size() == 2);
+ if (args->size() > 2)
+ {
+ this->report_error(_("too many arguments"));
+ break;
+ }
std::string reason;
if (!Type::are_assignable(args->front()->type(), args->back()->type(),
&reason))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-12-22 23:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-23 0:41 Go patch committed: Don't crash on invalid call to append 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).