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: sparse slices with struct items are not initialized [1.12 backport] #32013
Comments
This bug causes incorrect code generation for some slice literals, with keyed entries, with values which are statically computable structs or arrays. There's no easy workaround. |
Change https://golang.org/cl/177040 mentions this issue: |
Closed by merging ecf7695 to release-branch.go1.12. |
…ntries of slices If a slice's entries are sparse, we decide to initialize it dynamically instead of statically. That's CL 151319. But if we do initialize it dynamically, we still need to initialize the static entries. Typically we do that, but the bug fixed here is that we don't if the entry's value is itself an array or struct. To fix, use initKindLocalCode to ensure that both static and dynamic entries are initialized via code. Fixes #32013 Change-Id: I1192ffdbfb5cd50445c1206c4a3d8253295201dd Reviewed-on: https://go-review.googlesource.com/c/go/+/176904 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> (cherry picked from commit a9e107c) Reviewed-on: https://go-review.googlesource.com/c/go/+/177040 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@randall77 In https://golang.org/cl/177040, a complex testcase has been proposed by the reviewer. I don't see it added in the codebase. Is there a reason why this non-regression check has not been added? |
@dolmen: I'm confused. There's no such complex test case proposed in that CL. |
@randall77 requested issue #31987 to be considered for backport to the next 1.12 minor release.
The text was updated successfully, but these errors were encountered: