Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: illegal ARM64 assembly generated #24333

Closed
benshi001 opened this issue Mar 10, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@benshi001
Copy link
Member

commented Mar 10, 2018

The following code

func iri(a *[30]byte) {
    	*a = [30]byte{}
}

is compiled to

    00000 (3)       TEXT    "".iri(SB)
    00001 (3)       FUNCDATA        $0, gclocals·a36216b97439c93dafebe03e7f0808b5(SB)
    00002 (3)       FUNCDATA        $1, gclocals·33cdeccccebe80329f1fdbee7f5874cb(SB)
v10 00003 (3)       MOVD    " " .a(RSP), R0
v3  00004 (4)       STP     (ZR, ZR), (R0)
v7  00005 (4)       STP     (ZR, ZR), 14(R0)
b1  00006 (5)       RET
    00007 (?)       END

But the STP instruction only accepts an 8-aligned offset in range -512 <-> 504.

@ALTree

This comment has been minimized.

Copy link
Member

commented Mar 10, 2018

Which Go versions are affected? Just tip? Tip and 1.10?

When you report bad codegen issues please always include details about the Go versions that you believe are affected. If it's just tip is one thing, if a released version (e.g. 1.10) is affected then the issue may require a minor release to fix it.

@ALTree ALTree changed the title illegal ARM64 assembly generated cmd/compile: illegal ARM64 assembly generated Mar 10, 2018

@benshi001

This comment has been minimized.

Copy link
Member Author

commented Mar 10, 2018

Sorry, it is my mistake, the "STP (ZR, ZR), 14(R0)" is expanded to

a.go:5                0x86818                 9100381b                ADD $14, R0, R27
a.go:5                0x8681c                 a9007f7f                STP (ZR, ZR), (R27)

Which are legal.

@benshi001 benshi001 closed this Mar 10, 2018

@golang golang locked and limited conversation to collaborators Mar 10, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.