hpy icon indicating copy to clipboard operation
hpy copied to clipboard

ambiguous struct fields in HPyType_Spec

Open mattip opened this issue 1 year ago • 3 comments

Currently HPyType_Spec uses HPyType_BuiltinShape which is an enum and long in its typedef https://github.com/hpyproject/hpy/blob/f6114734b4a5d03cfb9d24d3e8c71f77e8803881/hpy/devel/include/hpy/hpytype.h#L102 https://github.com/hpyproject/hpy/blob/f6114734b4a5d03cfb9d24d3e8c71f77e8803881/hpy/devel/include/hpy/hpytype.h#L131

These are ambiguous since enum does not have to be int and long is 4 bytes on windows but 8 everywhere else.

Also the struct is not aligned, it needs padding around the HPyType_BuiltinShape to align on 8 bytes.

mattip avatar Oct 31 '23 13:10 mattip