You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/compile: crash on pointer conversion in call to mapaccess2 #51840
<autogenerated>:1: cannot use &.autotmp_19 (type *struct { netip.addr netip.uint128; netip.z *intern.Value }) as type *netip.Addr in argument to runtime.mapaccess2
Other remarks
This seems to only happen when maps.Equal is used in the method even if the method is not called. There is no error when it is called directly: https://go.dev/play/p/KlpiWS96MA-
changed the title [-]x/exp/maps and netip: error when using maps.Equal in a Method on generic map with netip.Addr as keys[/-][+]cmd/compile: crash on pointer conversion in call to mapaccess2[/+]on Mar 21, 2022
@wdvxdr1123 Thanks, for the heads up. That's unexpected, but a believable effect.
If anyone wants to contribute a CL adding the failure cases as a regression test, that would be great. (Just add a file $GOROOT/test/fixedbugs/issue51840.go that demonstrates the previously failing code now compiles correctly. Look for other "// compile" or "// run" test cases in the directory, if you need inspiration.)
Activity
ianlancetaylor commentedon Mar 21, 2022
Here is a standalone test case. CC @randall77 @mdempsky
[-]x/exp/maps and netip: error when using maps.Equal in a Method on generic map with netip.Addr as keys[/-][+]cmd/compile: crash on pointer conversion in call to mapaccess2[/+]ianlancetaylor commentedon Mar 21, 2022
@gopherbot Please open a backport to 1.18
This is a compiler crash on valid code.
gopherbot commentedon Mar 21, 2022
Backport issue(s) opened: #51849 (for 1.18).
Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.
blackgreen100 commentedon Apr 7, 2022
it seems the crash reproduces also on
mapassign, and also when the key's underlying type is some composite type with more than one member:struct { x, y int }crashesstruct { x int }does not crash[2]uint64crashes[1]uint64does not crashAdd generic Set type and use it (#2243)
wdvxdr1123 commentedon May 7, 2022
I noticed this issue has been fixed in 115c3bf.
mdempsky commentedon May 7, 2022
@wdvxdr1123 Thanks, for the heads up. That's unexpected, but a believable effect.
If anyone wants to contribute a CL adding the failure cases as a regression test, that would be great. (Just add a file $GOROOT/test/fixedbugs/issue51840.go that demonstrates the previously failing code now compiles correctly. Look for other "// compile" or "// run" test cases in the directory, if you need inspiration.)
Otherwise, I'll prepare one on Monday.
gopherbot commentedon May 8, 2022
Change https://go.dev/cl/404914 mentions this issue:
test: add test case for #51840gopherbot commentedon May 10, 2022
Change https://go.dev/cl/405436 mentions this issue:
[release-branch.go1.18] cmd/compile: backport fix for #51840[release-branch.go1.18] cmd/compile: backport fix for #51840
gopherbot commentedon Jul 14, 2022
Change https://go.dev/cl/417616 mentions this issue:
Revert "[release-branch.go1.18] cmd/compile: backport fix for #51840"[release-branch.go1.18] cmd/compile: revert "backport fix for #51840"
test: add test case for golang#51840