x/tools/go/ssa: bad RHS operand type for shift= statements #52342
Labels
FrozenDueToAge
NeedsFix
The path to resolution is known, but the work has not been done.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
Compiling
with x/tools/go/ssa produces:
See https://go.dev/play/p/XugtNClNWNp?v=gotip
But a
1000:int8
constant is ill typed, because 1000 is out of range forint8
. Moreover, there's no reason1000
needs to beint8
, it's fine asuint
.Notably, if the code is changed to
d = d >> 1000
, then the1000
constant is correctly typed asuint
.I think the fix is in builder.assignOp: it should only apply
b.emitConv(val, oldv.Type())
whenop
isn't LSH or RSH. When it is a shift, it should just useval
as is./cc @timothy-king @zpavlinovic
The text was updated successfully, but these errors were encountered: