From 7838059fb2e20689a98ece0f077ed288146515b6 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 22 Dec 2010 23:57:28 +0000 Subject: Don't crash on invalid call to append. From-SVN: r168187 --- gcc/go/gofrontend/expressions.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 491b71a..ea5821b 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -7387,8 +7387,11 @@ Builtin_call_expression::do_check_types(Gogo*) 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)) -- cgit v1.1