]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: prevent shapifying of pointer shape type
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Mon, 15 Sep 2025 10:31:46 +0000 (17:31 +0700)
committerGopher Robot <gobot@golang.org>
Tue, 23 Sep 2025 18:43:48 +0000 (11:43 -0700)
commita5866ebe40207c4c64f0522721825b10887356e0
treef22e7f664af062ea00b4ffae14fe51664489760e
parenta27261c42fcebf601587725714b9ef53c47b06b3
cmd/compile: prevent shapifying of pointer shape type

CL 641955 changes the Unified IR reader to not doing shapify when
reading reshaping expression, prevent losing of the original type.

This is an oversight, as the main problem isn't about shaping during the
reshaping process itself, but about the specific case of shaping a
pointer shape type. This bug occurs when instantiating a generic
function within another generic function with a pointer shape type as
type parameter, which will convert `*[]go.shape.T` to `*go.shape.uint8`,
resulting in the loss of the original expression's type.

This commit changes Unified IR reader to avoid pointer shaping for
`*[]go.shape.T`, ensures that the original type is preserved when
processing reshaping expressions.

Updates #71184
Updates #73947
Fixes #74260
Fixes #75461

Change-Id: Icede6b73247d0d367bb485619f2dafb60ad66806
Reviewed-on: https://go-review.googlesource.com/c/go/+/704095
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
src/cmd/compile/internal/noder/reader.go
src/cmd/compile/testdata/script/issue75461.txt [new file with mode: 0644]