# New Ticket Created by  Sylvain Colinet 
# Please include the string:  [perl #126675]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=126675 >


While writing a binding for Gumbo (A c99 lib to parse html) I came across an 
error on amd64 bits. One of the mapped struct has his size evaluated wrongly by 
nativesizeof (different than a call from sizeof see: 
http://pastebin.com/FVagmG6T). It provokes random segfault because of that. It 
seem NC try to align the struct and fail. (8 bytes are added)

After isolating on a test file the struct (see attached file) and tracking some 
value on
https://github.com/MoarVM/MoarVM/blob/master/src/6model/reprs/CStruct.c#L110

I appear that after evaluating the size of the 2 last attributes (12 bytes each 
one)
https://github.com/MoarVM/MoarVM/blob/master/src/6model/reprs/CStruct.c#L256
realign the size and adding 2 time 4 bytes, ending with the wrong size of 104 
bytes instead of 96.
I don't know if the align for the struct that is 12 bytes sized should be 4 
bytes (and not ALIGNOF(void*) that is 8 for 64bits) or just the pointed (L256) 
adjustment is wrong

Attachment: testwrongsize.p6
Description: Binary data

Reply via email to