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

cmd/compile: sparse slices with struct items are not initialized [1.12 backport] #32013

Closed
gopherbot opened this issue May 13, 2019 · 5 comments
Closed

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented May 13, 2019

@randall77 requested issue #31987 to be considered for backport to the next 1.12 minor release.

@gopherbot Please open a backport to 1.12.

@randall77

This comment has been minimized.

Copy link
Contributor

@randall77 randall77 commented May 13, 2019

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.
The bug was introduced in 1.12, 1.11 is ok.

@gopherbot

This comment has been minimized.

Copy link
Author

@gopherbot gopherbot commented May 14, 2019

Change https://golang.org/cl/177040 mentions this issue: cmd/compile: make sure to initialize static entries of slices

@gopherbot

This comment has been minimized.

Copy link
Author

@gopherbot gopherbot commented May 14, 2019

Closed by merging ecf7695 to release-branch.go1.12.

@gopherbot gopherbot closed this May 14, 2019
gopherbot pushed a commit that referenced this issue May 14, 2019
…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>
@dolmen

This comment has been minimized.

Copy link

@dolmen dolmen commented Jun 12, 2019

@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?

@randall77

This comment has been minimized.

Copy link
Contributor

@randall77 randall77 commented Jun 12, 2019

@dolmen: I'm confused. There's no such complex test case proposed in that CL.
Do you mean Josh's test case in https://go-review.googlesource.com/c/go/+/176904/ ?
There's no reason it wasn't added. You can make a CL with it if you'd like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.