You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The compiler and go/types disagree about the offset of y in
varsstruct {
x*inty []byte
}
on 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.
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.
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: