-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/compile: 1-sized array's pointer typed element set to nil, after received from channel and print in a loop #22683
Comments
I dont understand the issue. Why are you closing the channel and then attempting to recieve on that closed channel? |
@as receiving from the closed channel is safe, it will read all the remaining values. |
Given that there are no explicit goroutines and that printing a value changes the behavior, I think this is a compiler bug or perhaps a runtime bug. |
I can repro this with Go 1.9, but it seems to work as expected at master. |
Array-of-size-1 is a special case in the SSA code, too. |
This is the buggy rule:
It allows the load to move blocks. It needs an @v.Block modifier, I think. |
The bad rule was removed at tip during https://go-review.googlesource.com/c/go/+/71731 . Seems coincidental that it was removed, but that's why tip is ok. |
Add test + candidate for backport? |
Change https://golang.org/cl/77331 mentions this issue: |
Change https://golang.org/cl/77332 mentions this issue: |
The removal was indeed coincidental; since I was freshening someone else's old patch, I just kept the change. I'm trying to figure out if we need it, given the other make and select rules. |
This test fails on 1.9.2, but is ok on tip. CL 77331 has both the 1.9.2 fix and this test, and is on the 1.9 release branch. This CL is just the test, and is on HEAD. The buggy code doesn't exist on tip. Update #22683 Change-Id: I04a24bd6c2d3068e18ca81da3347e2c1366f4447 Reviewed-on: https://go-review.googlesource.com/77332 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
CL 77331 OK for Go 1.9.3. |
Change https://golang.org/cl/88320 mentions this issue: |
…rays The offending rule could move the load to a different block, which is always a bad idea. Fixes #22683 Change-Id: I973c88389b2359f734924d9f45c3fb38e166691d Reviewed-on: https://go-review.googlesource.com/77331 Run-TryBot: Andrew Bonventre <andybons@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com>
go1.9.3 has been packaged and includes:
The release is posted at golang.org/dl. — golang.org/x/build/cmd/releasebot, Jan 22 21:02:55 UTC |
What version of Go are you using (
go version
)?go version go1.9.2 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
What did you see instead?
Playground link:
https://play.golang.org/p/Qd8fDy-ls3
The text was updated successfully, but these errors were encountered: