diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index bfc1b625d71b6e90e9e05872a6564d98c071c741..e0690e77bf6561e76f891de8541eaf913eda9008 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -5610,6 +5610,11 @@ Binary_expression::do_check_types(Gogo*) || this->op_ == OPERATOR_GT || this->op_ == OPERATOR_GE) { + if (left_type->is_nil_type() && right_type->is_nil_type()) + { + this->report_error(_("invalid comparison of nil with nil")); + return; + } if (!Type::are_assignable(left_type, right_type, NULL) && !Type::are_assignable(right_type, left_type, NULL)) {