-
Notifications
You must be signed in to change notification settings - Fork 18k
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
go/types, cmd/compile: disagreement on struct field offset on amd64p32 #16464
Labels
Milestone
Comments
4 sounds like the correct answer to me. |
amd64p32 is an odd ball here. The correct field offset of y is 4. If the
size of field is less than MaxAlign, its alignment should be its size. And
we need to treat slices as a three element structs.
|
I'll take this. |
I have a working CL already. Just haven't had time to mail it yet. |
CL https://golang.org/cl/26991 mentions this issue. |
CL https://golang.org/cl/26996 mentions this issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The compiler and go/types disagree about the offset of
y
inon amd64p32. I am using sizes
types.StdSizes{WordSize: 4, MaxAlign: 8}
. The compiler says y's offset is 4; go/types says it is 8. I think the compiler is right, insofar as code relying on this runs and works on nacl.https://play.golang.org/p/VbR2IIeyUt calculates and displays the offsets of x and y via unsafe and via go/types. Since the playground runs amd64p32, you can see the results directly by hitting Run. I also confirmed with nacl/amd64p32 locally.
Found while working on #11041. I'm happy to look into a fix, but I'd like confirmation first that the correct answer is 4.
cc @griesemer
The text was updated successfully, but these errors were encountered: