mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.simd] cmd/compile: widen index for simd intrinsics jumptable
Feeding an unconverted uint8 to the jumptable can cause problems either in constant propagation or later at runtime, depending on details of the input code. Change-Id: I5fa2299a77a73172349a165f773cf9d1198212bc Reviewed-on: https://go-review.googlesource.com/c/go/+/702755 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
This commit is contained in:
parent
e34ad6de42
commit
31b664d40b
1 changed files with 3 additions and 1 deletions
|
|
@ -1697,11 +1697,13 @@ func immJumpTable(s *state, idx *ssa.Value, intrinsicCall *ir.CallExpr, genOp fu
|
||||||
// Make blocks we'll need.
|
// Make blocks we'll need.
|
||||||
bEnd := s.f.NewBlock(ssa.BlockPlain)
|
bEnd := s.f.NewBlock(ssa.BlockPlain)
|
||||||
|
|
||||||
t := types.Types[types.TUINT8]
|
|
||||||
if !idx.Type.IsKind(types.TUINT8) {
|
if !idx.Type.IsKind(types.TUINT8) {
|
||||||
panic("immJumpTable expects uint8 value")
|
panic("immJumpTable expects uint8 value")
|
||||||
}
|
}
|
||||||
|
|
||||||
// We will exhaust 0-255, so no need to check the bounds.
|
// We will exhaust 0-255, so no need to check the bounds.
|
||||||
|
t := types.Types[types.TUINTPTR]
|
||||||
|
idx = s.conv(nil, idx, idx.Type, t)
|
||||||
|
|
||||||
b := s.curBlock
|
b := s.curBlock
|
||||||
b.Kind = ssa.BlockJumpTable
|
b.Kind = ssa.BlockJumpTable
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue