From: Ian Lance Taylor Date: Tue, 4 Dec 2012 06:44:19 +0000 (+0000) Subject: compiler: Reject invalid nil == nil comparisons. X-Git-Tag: releases/gcc-4.8.0~1601 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3fa057a43770dbb23a0fb21a94cab1789df3277c;p=thirdparty%2Fgcc.git compiler: Reject invalid nil == nil comparisons. From-SVN: r194119 --- diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index bfc1b625d71b..e0690e77bf65 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)) {