]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/arm64: fix the wrong error message of out-of-range checking
authoreric fang <eric.fang@arm.com>
Tue, 27 Apr 2021 06:19:57 +0000 (06:19 +0000)
committereric fang <eric.fang@arm.com>
Wed, 28 Apr 2021 01:16:38 +0000 (01:16 +0000)
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>

src/cmd/asm/internal/asm/testdata/arm64error.s
src/cmd/internal/obj/arm64/asm7.go

index 1744c09b98f868d512c5d461f24dd63567b99812..feb03abacdacfc7699c0dfd1e577bb281c3fa1e4 100644 (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"
index 64067a4a1715ac08f89ddcfa112c226409e3c232..f2188c3403ca3489f3e29349036773a18faff207 100644 (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 {