cmd/compile: rewriteFixedLoad: ensure AuxInt is sign-extended
CL 701297 accidentailly broke the type casting behavior for Hash.
Previously, the generated rules for Hash shared a common pattern:
v.AuxInt = int32ToAuxInt(fixed32(config, sym, off))
which inherently equaled to a signed-extend:
v.AuxInt = int64(int32(types.TypeHash(...)))
The pattern in CL 701297 was however:
v.AuxInt = int64(types.TypeHash(t))
Since types.TypeHash() returns a uint32, casting it to a wider integer
implies zero-extend. This diverges from the definition of AuxInt, in
which "Unused portions are filled by sign-extending the used portion,
even if the represented value is unsigned."
As a result, ssa.checkFunc(), where AuxInt is checked against the
mentioned rule, is unhappy and shouts:
internal compiler error: 'typeAsserts': bad int32 AuxInt value for v1317
Reproduce it with:
GOARCH=mips go tool compile -m -d=ssa/check/on test/devirtualization.go
This is only reproducible with GOARCH=mips/mipsle (cross and native).
Probably the rewrite rules of other architectures prevent Hash from
running into rewriteFixedLoad.
Fix it by emit sign-extend properly. Additionally, do the same for Kind_
as reflectdata.ABIKindOfType() also returns a fragile unsigned interger
(uint8).
Updates #67304
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |