diff options
| author | Ben Shi <powerman1st@163.com> | 2018-07-24 03:47:39 +0000 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2018-07-30 15:31:06 +0000 |
| commit | e351a1600514b6a4ae18c4b44e883b049c314ebd (patch) | |
| tree | 620b852c400fa659f6be2e7da4873e663a212423 /src/cmd/internal/obj/arm64 | |
| parent | 86f907fdecbf0bdf5d97070205b7c965e3ab2b9b (diff) | |
| download | go-e351a1600514b6a4ae18c4b44e883b049c314ebd.tar.xz | |
cmd/internal/obj/arm64: reject incorrect form of LDP/STP
"LDP (R0), (F0, F1)" and "STP (F1, F2), (R0)" are
silently accepted by the arm64 assembler without
any error message. And this CL fixes that bug.
fixes #26556.
Change-Id: Ib6fae81956deb39a4ffd95e9409acc8dad3ab2d2
Reviewed-on: https://go-review.googlesource.com/125637
Run-TryBot: Ben Shi <powerman1st@163.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/internal/obj/arm64')
| -rw-r--r-- | src/cmd/internal/obj/arm64/asm7.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cmd/internal/obj/arm64/asm7.go b/src/cmd/internal/obj/arm64/asm7.go index 192d65df96..ff4b1d7ec1 100644 --- a/src/cmd/internal/obj/arm64/asm7.go +++ b/src/cmd/internal/obj/arm64/asm7.go @@ -6160,6 +6160,16 @@ func (c *ctxt7) opldpstp(p *obj.Prog, o *Optab, vo int32, rbase, rl, rh, ldp uin default: c.ctxt.Diag("invalid instruction %v\n", p) } + switch p.As { + case ALDP, ALDPW, ALDPSW: + if rl < REG_R0 || REG_R30 < rl || rh < REG_R0 || REG_R30 < rh { + c.ctxt.Diag("invalid register pair %v\n", p) + } + case ASTP, ASTPW: + if rl < REG_R0 || REG_R31 < rl || rh < REG_R0 || REG_R31 < rh { + c.ctxt.Diag("invalid register pair %v\n", p) + } + } switch o.scond { case C_XPOST: ret |= 1 << 23 |
