Skip to content

Commit af03343

Browse files
committed
cmd/compile: fix bounds check report
For constant-index, variable length situations. Inadvertant shadowing of the yVal variable. Oops. Fixes #75327 Change-Id: I3403066fc39b7664222a3098cf0f22b5761ea66a Reviewed-on: https://go-review.googlesource.com/c/go/+/702015 Reviewed-by: Cuong Manh Le <[email protected]> Reviewed-by: David Chase <[email protected]> Reviewed-by: Keith Randall <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 6447ff4 commit af03343

File tree

11 files changed

+43
-10
lines changed

11 files changed

+43
-10
lines changed

src/cmd/compile/internal/amd64/ssa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
13061306
}
13071307
case ssa.OpAMD64LoweredPanicBoundsCR:
13081308
yIsReg = true
1309-
yVal := int(v.Args[0].Reg() - x86.REG_AX)
1309+
yVal = int(v.Args[0].Reg() - x86.REG_AX)
13101310
c := v.Aux.(ssa.PanicBoundsC).C
13111311
if c >= 0 && c <= abi.BoundsMaxConst {
13121312
xVal = int(c)

src/cmd/compile/internal/arm/ssa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
777777
}
778778
case ssa.OpARMLoweredPanicBoundsCR:
779779
yIsReg = true
780-
yVal := int(v.Args[0].Reg() - arm.REG_R0)
780+
yVal = int(v.Args[0].Reg() - arm.REG_R0)
781781
c := v.Aux.(ssa.PanicBoundsC).C
782782
if c >= 0 && c <= abi.BoundsMaxConst {
783783
xVal = int(c)

src/cmd/compile/internal/arm64/ssa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
13191319
}
13201320
case ssa.OpARM64LoweredPanicBoundsCR:
13211321
yIsReg = true
1322-
yVal := int(v.Args[0].Reg() - arm64.REG_R0)
1322+
yVal = int(v.Args[0].Reg() - arm64.REG_R0)
13231323
c := v.Aux.(ssa.PanicBoundsC).C
13241324
if c >= 0 && c <= abi.BoundsMaxConst {
13251325
xVal = int(c)

src/cmd/compile/internal/loong64/ssa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
811811
}
812812
case ssa.OpLOONG64LoweredPanicBoundsCR:
813813
yIsReg = true
814-
yVal := int(v.Args[0].Reg() - loong64.REG_R4)
814+
yVal = int(v.Args[0].Reg() - loong64.REG_R4)
815815
c := v.Aux.(ssa.PanicBoundsC).C
816816
if c >= 0 && c <= abi.BoundsMaxConst {
817817
xVal = int(c)

src/cmd/compile/internal/mips/ssa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
551551
}
552552
case ssa.OpMIPSLoweredPanicBoundsCR:
553553
yIsReg = true
554-
yVal := int(v.Args[0].Reg() - mips.REG_R1)
554+
yVal = int(v.Args[0].Reg() - mips.REG_R1)
555555
c := v.Aux.(ssa.PanicBoundsC).C
556556
if c >= 0 && c <= abi.BoundsMaxConst {
557557
xVal = int(c)

src/cmd/compile/internal/mips64/ssa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
542542
}
543543
case ssa.OpMIPS64LoweredPanicBoundsCR:
544544
yIsReg = true
545-
yVal := int(v.Args[0].Reg() - mips.REG_R1)
545+
yVal = int(v.Args[0].Reg() - mips.REG_R1)
546546
c := v.Aux.(ssa.PanicBoundsC).C
547547
if c >= 0 && c <= abi.BoundsMaxConst {
548548
xVal = int(c)

src/cmd/compile/internal/ppc64/ssa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1947,7 +1947,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
19471947
}
19481948
case ssa.OpPPC64LoweredPanicBoundsCR:
19491949
yIsReg = true
1950-
yVal := int(v.Args[0].Reg() - ppc64.REG_R3)
1950+
yVal = int(v.Args[0].Reg() - ppc64.REG_R3)
19511951
c := v.Aux.(ssa.PanicBoundsC).C
19521952
if c >= 0 && c <= abi.BoundsMaxConst {
19531953
xVal = int(c)

src/cmd/compile/internal/riscv64/ssa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
544544
}
545545
case ssa.OpRISCV64LoweredPanicBoundsCR:
546546
yIsReg = true
547-
yVal := int(v.Args[0].Reg() - riscv.REG_X5)
547+
yVal = int(v.Args[0].Reg() - riscv.REG_X5)
548548
c := v.Aux.(ssa.PanicBoundsC).C
549549
if c >= 0 && c <= abi.BoundsMaxConst {
550550
xVal = int(c)

src/cmd/compile/internal/s390x/ssa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
608608
}
609609
case ssa.OpS390XLoweredPanicBoundsCR:
610610
yIsReg = true
611-
yVal := int(v.Args[0].Reg() - s390x.REG_R0)
611+
yVal = int(v.Args[0].Reg() - s390x.REG_R0)
612612
c := v.Aux.(ssa.PanicBoundsC).C
613613
if c >= 0 && c <= abi.BoundsMaxConst {
614614
xVal = int(c)

src/cmd/compile/internal/x86/ssa.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
804804
}
805805
case ssa.Op386LoweredPanicBoundsCR:
806806
yIsReg = true
807-
yVal := int(v.Args[0].Reg() - x86.REG_AX)
807+
yVal = int(v.Args[0].Reg() - x86.REG_AX)
808808
c := v.Aux.(ssa.PanicBoundsC).C
809809
if c >= 0 && c <= abi.BoundsMaxConst {
810810
xVal = int(c)

0 commit comments

Comments
 (0)