diff options
author | Tom Thorogood <me+google@tomthorogood.co.uk> | 2021-02-01 13:32:18 +1030 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2021-02-01 21:38:01 +0000 |
commit | 32e789f4fb45b6296b9283ab80e126287eab4db5 (patch) | |
tree | 1045dc17eb3ecbbd1e506d2010843430702b530c | |
parent | 0b6cfea6342a7d95f74bc9e273039236ebd7e64f (diff) | |
download | go-32e789f4fb45b6296b9283ab80e126287eab4db5.tar.gz go-32e789f4fb45b6296b9283ab80e126287eab4db5.zip |
test: fix incorrectly laid out instructions in issue11656.go
CL 279423 introduced a regression in this test as it incorrectly laid
out various instructions. In the case of arm, the second instruction
was overwriting the first. In the case of 386, amd64 and s390x, the
instructions were being appended to the end of the slice after 64
zero bytes.
This was causing test failures on "linux/s390x on z13".
Fixes #44028
Change-Id: Id136212dabdae27db7e91904b0df6a3a9d2f4af4
Reviewed-on: https://go-review.googlesource.com/c/go/+/288278
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
-rw-r--r-- | test/fixedbugs/issue11656.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/fixedbugs/issue11656.go b/test/fixedbugs/issue11656.go index acd3f4f3e5d..85fe720b30b 100644 --- a/test/fixedbugs/issue11656.go +++ b/test/fixedbugs/issue11656.go @@ -59,10 +59,10 @@ func f(n int) { ill := make([]byte, 64) switch runtime.GOARCH { case "386", "amd64": - ill = append(ill, 0x89, 0x04, 0x25, 0x00, 0x00, 0x00, 0x00) // MOVL AX, 0 + ill = append(ill[:0], 0x89, 0x04, 0x25, 0x00, 0x00, 0x00, 0x00) // MOVL AX, 0 case "arm": - binary.LittleEndian.PutUint32(ill, 0xe3a00000) // MOVW $0, R0 - binary.LittleEndian.PutUint32(ill, 0xe5800000) // MOVW R0, (R0) + binary.LittleEndian.PutUint32(ill[0:4], 0xe3a00000) // MOVW $0, R0 + binary.LittleEndian.PutUint32(ill[4:8], 0xe5800000) // MOVW R0, (R0) case "arm64": binary.LittleEndian.PutUint32(ill, 0xf90003ff) // MOVD ZR, (ZR) case "ppc64": @@ -74,7 +74,7 @@ func f(n int) { case "mipsle", "mips64le": binary.LittleEndian.PutUint32(ill, 0xfc000000) // MOVV R0, (R0) case "s390x": - ill = append(ill, 0xa7, 0x09, 0x00, 0x00) // MOVD $0, R0 + ill = append(ill[:0], 0xa7, 0x09, 0x00, 0x00) // MOVD $0, R0 ill = append(ill, 0xe3, 0x00, 0x00, 0x00, 0x00, 0x24) // MOVD R0, (R0) case "riscv64": binary.LittleEndian.PutUint32(ill, 0x00003023) // MOV X0, (X0) |