Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime/race: missed race on []Struct #4453

Closed
dvyukov opened this issue Nov 27, 2012 · 4 comments
Closed

runtime/race: missed race on []Struct #4453

dvyukov opened this issue Nov 27, 2012 · 4 comments

Comments

@dvyukov
Copy link
Member

dvyukov commented Nov 27, 2012

The race in the following test is not detected, because slice operations imitate
accesses only to the beginning of each element, so it detects similar race on x[1].x but
not on x[1].y.

func TestRaceFailingSliceStruct(t *testing.T) {
    type X struct {
        x, y int
    }
    c := make(chan bool, 1)
    x := make([]X, 10)
    go func() {
        y := make([]X, 10)
        copy(y, x)
        c <- true
    }()
    x[1].y = 42
    <-c
}
@rsc
Copy link
Contributor

rsc commented Dec 10, 2012

Comment 1:

Marking all race detector bugs as Go1.1Maybe, not because they're unimportant but
because I don't expect non-dvyukov contributors to look at them.

Labels changed: added go1.1maybe, removed go1.1.

@rsc
Copy link
Contributor

rsc commented Mar 12, 2013

Comment 2:

[The time for maybe has passed.]

Labels changed: removed go1.1maybe.

@robpike
Copy link
Contributor

robpike commented May 18, 2013

Comment 3:

Labels changed: added go1.2maybe.

@dvyukov
Copy link
Member Author

dvyukov commented Jun 13, 2013

Comment 4:

This issue was closed by revision cc99e6e.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants