From patchwork Sat Nov 10 20:27:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: libgo patch committed: Fix bug comparing struct field types From: Ian Taylor X-Patchwork-Id: 198207 Message-Id: To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Date: Sat, 10 Nov 2012 12:27:47 -0800 This patch fixes a bug comparing struct field types in the reflect package. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline and 4.7 branch. Ian diff -r 8b1f2a35ded1 libgo/go/reflect/type.go --- a/libgo/go/reflect/type.go Tue Nov 06 10:44:51 2012 -0800 +++ b/libgo/go/reflect/type.go Sat Nov 10 12:20:00 2012 -0800 @@ -1309,8 +1309,19 @@ for i := range t.fields { tf := &t.fields[i] vf := &v.fields[i] - if tf.name != vf.name || tf.pkgPath != vf.pkgPath || - tf.typ != vf.typ || tf.tag != vf.tag || tf.offset != vf.offset { + if tf.name != vf.name && (tf.name == nil || vf.name == nil || *tf.name != *vf.name) { + return false + } + if tf.pkgPath != vf.pkgPath && (tf.pkgPath == nil || vf.pkgPath == nil || *tf.pkgPath != *vf.pkgPath) { + return false + } + if tf.typ != vf.typ { + return false + } + if tf.tag != vf.tag && (tf.tag == nil || vf.tag == nil || *tf.tag != *vf.tag) { + return false + } + if tf.offset != vf.offset { return false } }