summaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2020-01-07 13:44:29 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2020-01-07 13:44:29 +0000
commitb46e3849d507b61b2537f48150864d218b31b550 (patch)
tree7c9dac0d933b75f3dfe24025ed08cc2a892a50a4 /gcc/go
parentb11b9e29f5b4585cf2e01a25977de5c92c0eddd9 (diff)
compiler: avoid a couple of compiler crashes
These came up while building 1.14beta1 while the code was still invalid. The policy is to not bother committing invalid test cases that cause compiler crashes. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/213537 From-SVN: r279956
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc9
2 files changed, 10 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index ea09abe4242..6dca40fe31a 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-9163fa28b89222cd851c0d24bd6a1384d1379c55
+d0a102eea2262e3fca89b1eb342fd03328c4aa16
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index ecb28e05940..8d72b1f478c 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -11766,10 +11766,17 @@ Call_expression::do_add_conversions()
Typed_identifier_list::const_iterator pp = fntype->parameters()->begin();
bool is_interface_method =
this->fn_->interface_field_reference_expression() != NULL;
+ size_t argcount = this->args_->size();
if (!is_interface_method && fntype->is_method())
{
// Skip the receiver argument, which cannot be interface.
pa++;
+ argcount--;
+ }
+ if (argcount != fntype->parameters()->size())
+ {
+ go_assert(saw_errors());
+ return;
}
for (; pa != this->args_->end(); ++pa, ++pp)
{
@@ -11895,6 +11902,8 @@ Call_expression::is_erroneous_call()
Type*
Call_expression::do_type()
{
+ if (this->is_error_expression())
+ return Type::make_error_type();
if (this->type_ != NULL)
return this->type_;