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: typebits.Set: invalid initial alignment: type Peer has alignment 8, but offset is 4 #54991
Comments
It seems to me that CL 425256 only handles local variables. While the problem in this issue is for arguments which are on stack. |
Minimal reproducer:
|
Seems that we can't do the same trick with autotmp, the arguments frame offset is used to write function stack map, so it can't be fake. |
I haven't looked into this issue. But I think CL 425256 should handle autotmp. I'll see what we missed. |
Yeah, see my comment above. This issue is about parameters which are on stack, specifically for the reproducer, it's .this receiver of wrapper method. |
Seems to be ok for 386, just not arm. |
To be clear, it's not passing an atomic around, it's the
Previously, this can't happen because Maybe for |
Hi there 👋, is there a chance to work around this bug in my current code?
This hints, that passing it around as a pointer would work? |
@stv0g one way to workaround is not using the embedded interface type, making it an explicit field instead. For example, for the reproducer above, you can do:
Notice |
We don't want to do that always, as we do want to be able to align to 8 bytes on 4 byte platforms on the heap. But maybe for all arg/result bitmap generation, yes. It is all kinda hacky however we handle it. I was thinking that it wouldn't actually break the calling convention to align things more, as nothing is 8-byte aligned at the moment on arm. So we could pad somehow if we knew one of the args needed >4 byte alignment. But this is going to be a really rare case which makes it hard to ensure that we've got it right. I'm leaning towards just removing the check. |
Change https://go.dev/cl/431098 mentions this issue: |
@randall77 @cherrymui should we backport this? |
I would highly appreciate it as it breaks valid Go code in the current release. |
Reopen for considering backport discussion. Kindly cc @randall77 @cherrymui |
SGTM for backporting. @gopherbot please backport this to Go 1.19 . This causes valid program fail to compile. |
Backport issue(s) opened: #55152 (for 1.19). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
Closing this as it is fixed. |
This is seems to be a regression of: #54638
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Not, tested.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
git clone github.com/stv0g/cunicu cd cunicu GOARCH=arm go build ./cmd/cunicu
What did you expect to see?
A successful build for 32-bit architectures.
What did you see instead?
The following compiler error:
This issue has been observed for the following
GOARCH=arm, mips
andGOOS=linux
64-bit builds (
GOOS=arm64, amd64
) are successful.The text was updated successfully, but these errors were encountered: