Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(525)

Issue 10271046: code review 10271046: cmd/gc: fix computation of equality class of types. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 9 months ago by remyoudompheng
Modified:
11 years, 9 months ago
Reviewers:
DMorsing, rsc
CC:
rsc, golang-dev, DMorsing, bradfitz, gri, r
Visibility:
Public.

Description

cmd/gc: fix computation of equality class of types. A struct with a single field was considered as equivalent to the field type, which is incorrect is the field is blank. Fields with padding could make the compiler think some types are comparable when they are not. Fixes issue 5698.

Patch Set 1 #

Patch Set 2 : diff -r 330478300ab0 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 330478300ab0 https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 330478300ab0 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 5 : diff -r 575afd15c877 https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 6 : diff -r dfb6b95d3a98 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -11 lines) Patch
M src/cmd/gc/subr.c View 1 2 3 4 1 chunk +9 lines, -9 lines 0 comments Download
M test/blank.go View 1 2 chunks +11 lines, -0 lines 0 comments Download
M test/blank1.go View 1 2 3 4 1 chunk +7 lines, -0 lines 0 comments Download
M test/cmp.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M test/cmp6.go View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
A test/fixedbugs/issue5698.go View 1 1 chunk +18 lines, -0 lines 0 comments Download

Messages

Total messages: 14
remyoudompheng
Hello rsc@golang.org, golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
11 years, 9 months ago (2013-06-13 21:20:28 UTC) #1
remyoudompheng
On 2013/06/13 21:20:28, remyoudompheng wrote: > Hello mailto:rsc@golang.org, mailto:golang-dev@googlegroups.com (cc: > mailto:golang-dev@googlegroups.com), > > I'd ...
11 years, 9 months ago (2013-06-13 21:23:01 UTC) #2
remyoudompheng
ping? or is it delayed until runtime is fixed?
11 years, 9 months ago (2013-06-18 06:57:50 UTC) #3
DMorsing
LGTM. I don't think this is blocked on the runtime freeze, but wait for Russ.
11 years, 9 months ago (2013-06-18 07:52:45 UTC) #4
bradfitz
R=rsc
11 years, 9 months ago (2013-06-21 16:17:24 UTC) #5
rsc
sorry, just overwhelmed by all the runtime stuff. will review tomorrow.
11 years, 9 months ago (2013-06-27 03:17:50 UTC) #6
rsc
I'm not sure actually. type T struct { _ []byte x int } var t1, ...
11 years, 9 months ago (2013-06-27 15:45:43 UTC) #7
gri
What Rémy says ( http://tip.golang.org/ref/spec#Comparison_operators ): "Struct values are comparable if *all* their fields are ...
11 years, 9 months ago (2013-06-27 16:29:55 UTC) #8
r
The spec sounds right to me. It would feel wrong if changing the name of ...
11 years, 9 months ago (2013-06-27 16:53:45 UTC) #9
rsc
Okay, we all agree that struct { _ []byte } is not comparable. Good.
11 years, 9 months ago (2013-06-27 17:11:22 UTC) #10
rsc
Please add a test that struct { _ []byte } is not comparable. https://codereview.appspot.com/10271046/diff/5001/src/cmd/gc/subr.c File ...
11 years, 9 months ago (2013-06-27 17:14:24 UTC) #11
remyoudompheng
Hello rsc@golang.org, golang-dev@googlegroups.com, daniel.morsing@gmail.com, bradfitz@golang.org, gri@golang.org, r@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
11 years, 9 months ago (2013-06-28 15:35:27 UTC) #12
rsc
LGTM Thanks very much. https://codereview.appspot.com/10271046/diff/18001/test/cmp.go File test/cmp.go (right): https://codereview.appspot.com/10271046/diff/18001/test/cmp.go#newcode299 test/cmp.go:299: _ string Nice. We all ...
11 years, 9 months ago (2013-07-02 01:49:40 UTC) #13
remyoudompheng
11 years, 9 months ago (2013-07-02 07:09:16 UTC) #14
*** Submitted as https://code.google.com/p/go/source/detail?r=3a652b14dccc ***

cmd/gc: fix computation of equality class of types.

A struct with a single field was considered as equivalent to the
field type, which is incorrect is the field is blank.

Fields with padding could make the compiler think some
types are comparable when they are not.

Fixes issue 5698.

R=rsc, golang-dev, daniel.morsing, bradfitz, gri, r
CC=golang-dev
https://codereview.appspot.com/10271046
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b