From: Ian Lance Taylor Date: Thu, 20 Sep 2012 04:35:13 +0000 (+0000) Subject: compiler: Fix struct hash and equality with _ fields. X-Git-Tag: misc/gccgo-go1_1_2~731 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c74ce92d54a4477b46288f6b3cd13d55885d350;p=thirdparty%2Fgcc.git compiler: Fix struct hash and equality with _ fields. From-SVN: r191511 --- diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 892c561d6a32..ea24849657b4 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -5178,6 +5178,9 @@ Binary_expression::lower_struct_comparison(Gogo* gogo, pf != fields->end(); ++pf, ++field_index) { + if (Gogo::is_sink_name(pf->field_name())) + continue; + if (field_index > 0) { if (left_temp == NULL) diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index d527787ca5a2..5c210cb28d91 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -579,6 +579,9 @@ Type::are_compatible_for_comparison(bool is_equality_op, const Type *t1, p != fields->end(); ++p) { + if (Gogo::is_sink_name(p->field_name())) + continue; + if (!p->type()->is_comparable()) { if (reason != NULL) @@ -4294,6 +4297,9 @@ Struct_type::do_compare_is_identity(Gogo* gogo) const pf != fields->end(); ++pf) { + if (Gogo::is_sink_name(pf->field_name())) + return false; + if (!pf->type()->compare_is_identity(gogo)) return false; @@ -4767,6 +4773,9 @@ Struct_type::write_hash_function(Gogo* gogo, Named_type*, pf != fields->end(); ++pf) { + if (Gogo::is_sink_name(pf->field_name())) + continue; + if (first) first = false; else @@ -4858,6 +4867,9 @@ Struct_type::write_equal_function(Gogo* gogo, Named_type* name) pf != fields->end(); ++pf, ++field_index) { + if (Gogo::is_sink_name(pf->field_name())) + continue; + // Compare one field in both P1 and P2. Expression* f1 = Expression::make_temporary_reference(p1, bloc); f1 = Expression::make_unary(OPERATOR_MULT, f1, bloc);