summaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-11 06:07:51 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2016-02-11 06:07:51 +0000
commit7f343dad554f0166f664cba7d6ab809ee4473f13 (patch)
tree5f549f9387f37ae57d7747549dd4403b83905370 /gcc/go
parentefdfa4676cd3506381bd987f7365767bb05c934a (diff)
downloadgcc-7f343dad554f0166f664cba7d6ab809ee4473f13.tar.gz
2016-02-11 Basile Starynkevitch <basile@starynkevitch.net>
{{merging with even more of GCC 6, using subversion 1.9 svn merge -r227821:227910 ^/trunk }} git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@233315 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc46
-rw-r--r--gcc/go/gofrontend/statements.cc5
3 files changed, 48 insertions, 5 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index bcaabac4b9c..f21c43a8c6d 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-01a574c1b2bb244be764b6a18aab980ca0aef43c
+e069d4417a692c1261df99fe3323277e1a0193d2
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 1c329b83050..7ad271f109b 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -1904,6 +1904,13 @@ Integer_expression::do_check_types(Gogo*)
Bexpression*
Integer_expression::do_get_backend(Translate_context* context)
{
+ if (this->is_error_expression()
+ || (this->type_ != NULL && this->type_->is_error_type()))
+ {
+ go_assert(saw_errors());
+ return context->gogo()->backend()->error_expression();
+ }
+
Type* resolved_type = NULL;
if (this->type_ != NULL && !this->type_->is_abstract())
resolved_type = this->type_;
@@ -2266,6 +2273,13 @@ Float_expression::do_check_types(Gogo*)
Bexpression*
Float_expression::do_get_backend(Translate_context* context)
{
+ if (this->is_error_expression()
+ || (this->type_ != NULL && this->type_->is_error_type()))
+ {
+ go_assert(saw_errors());
+ return context->gogo()->backend()->error_expression();
+ }
+
Type* resolved_type;
if (this->type_ != NULL && !this->type_->is_abstract())
resolved_type = this->type_;
@@ -2448,6 +2462,13 @@ Complex_expression::do_check_types(Gogo*)
Bexpression*
Complex_expression::do_get_backend(Translate_context* context)
{
+ if (this->is_error_expression()
+ || (this->type_ != NULL && this->type_->is_error_type()))
+ {
+ go_assert(saw_errors());
+ return context->gogo()->backend()->error_expression();
+ }
+
Type* resolved_type;
if (this->type_ != NULL && !this->type_->is_abstract())
resolved_type = this->type_;
@@ -2826,8 +2847,12 @@ Const_expression::do_check_types(Gogo*)
Bexpression*
Const_expression::do_get_backend(Translate_context* context)
{
- if (this->type_ != NULL && this->type_->is_error())
- return context->backend()->error_expression();
+ if (this->is_error_expression()
+ || (this->type_ != NULL && this->type_->is_error()))
+ {
+ go_assert(saw_errors());
+ return context->backend()->error_expression();
+ }
// If the type has been set for this expression, but the underlying
// object is an abstract int or float, we try to get the abstract
@@ -3447,6 +3472,15 @@ Unsafe_type_conversion_expression::do_get_backend(Translate_context* context)
Type* t = this->type_;
Type* et = this->expr_->type();
+
+ if (t->is_error_type()
+ || this->expr_->is_error_expression()
+ || et->is_error_type())
+ {
+ go_assert(saw_errors());
+ return context->backend()->error_expression();
+ }
+
if (t->array_type() != NULL)
go_assert(et->array_type() != NULL
&& t->is_slice_type() == et->is_slice_type());
@@ -13468,9 +13502,14 @@ Expression::make_heap_expression(Expression* expr, Location location)
Type*
Receive_expression::do_type()
{
+ if (this->is_error_expression())
+ return Type::make_error_type();
Channel_type* channel_type = this->channel_->type()->channel_type();
if (channel_type == NULL)
- return Type::make_error_type();
+ {
+ this->report_error(_("expected channel"));
+ return Type::make_error_type();
+ }
return channel_type->element_type();
}
@@ -13482,6 +13521,7 @@ Receive_expression::do_check_types(Gogo*)
Type* type = this->channel_->type();
if (type->is_error())
{
+ go_assert(saw_errors());
this->set_is_error();
return;
}
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index 5d102bf2e17..a84203a5fea 100644
--- a/gcc/go/gofrontend/statements.cc
+++ b/gcc/go/gofrontend/statements.cc
@@ -3856,7 +3856,10 @@ Switch_statement::do_lower(Gogo*, Named_object*, Block* enclosing,
if (this->val_ != NULL
&& (this->val_->is_error_expression()
|| this->val_->type()->is_error()))
- return Statement::make_error_statement(loc);
+ {
+ go_assert(saw_errors());
+ return Statement::make_error_statement(loc);
+ }
if (this->val_ != NULL
&& this->val_->type()->integer_type() != NULL