1
0
mirror of https://github.com/golang/go synced 2024-11-22 23:50:03 -07:00

cmd/internal/obj/arm64: fix the wrong error message of out-of-range checking

The error message of checking whether the offset value of load/store
instruction is out of range is wrong. The right range is [-256, 255], not
[-255, 254]. The CL fixes it.

Change-Id: Ia342957f1f6bcec65eceb45944221d3972641bed
Reviewed-on: https://go-review.googlesource.com/c/go/+/313891
Reviewed-by: eric fang <eric.fang@arm.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Trust: eric fang <eric.fang@arm.com>
Run-TryBot: eric fang <eric.fang@arm.com>
This commit is contained in:
eric fang 2021-04-27 06:19:57 +00:00
parent c9f43507c6
commit f439a76253
2 changed files with 4 additions and 4 deletions

View File

@ -59,8 +59,8 @@ TEXT errors(SB),$0
LDP (R0), (R3, ZR) // ERROR "invalid register pair"
LDXPW (RSP), (R2, R2) // ERROR "constrained unpredictable behavior"
LDAXPW (R5), (R2, R2) // ERROR "constrained unpredictable behavior"
MOVD.P 300(R2), R3 // ERROR "offset out of range [-255,254]"
MOVD.P R3, 344(R2) // ERROR "offset out of range [-255,254]"
MOVD.P 300(R2), R3 // ERROR "offset out of range [-256,255]"
MOVD.P R3, 344(R2) // ERROR "offset out of range [-256,255]"
MOVD (R3)(R7.SXTX<<2), R8 // ERROR "invalid index shift amount"
MOVWU (R5)(R4.UXTW<<3), R10 // ERROR "invalid index shift amount"
MOVWU (R5)(R4<<1), R10 // ERROR "invalid index shift amount"

View File

@ -3621,7 +3621,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
v := int32(p.From.Offset)
if v < -256 || v > 255 {
c.ctxt.Diag("offset out of range [-255,254]: %v", p)
c.ctxt.Diag("offset out of range [-256,255]: %v", p)
}
o1 = c.opldr(p, p.As)
if o.scond == C_XPOST {
@ -3639,7 +3639,7 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
v := int32(p.To.Offset)
if v < -256 || v > 255 {
c.ctxt.Diag("offset out of range [-255,254]: %v", p)
c.ctxt.Diag("offset out of range [-256,255]: %v", p)
}
o1 = c.opstr(p, p.As)
if o.scond == C_XPOST {