STINNER Victor <[email protected]> added the comment:
PyGC_Head structure size depends on the Python version, sizes of 64-bit:
* 2.7: 32 bytes
* 3.6, 3.7: 24 bytes
* 3.8 (master): 16 bytes
bpo-36618 "clang expects memory aligned on 16 bytes, but pymalloc aligns to 8
bytes" should be even worse on 3.7: 24 is not aligned on 16. I don't understand
why nobody saw this alignment issue previously. Maybe clang only became stricer
about 16 bytes alignment recently?
2.7:
typedef union _gc_head {
struct {
union _gc_head *gc_next;
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
double dummy; /* Force at least 8-byte alignment. */
char dummy_padding[sizeof(union _gc_head_old)];
} PyGC_Head;
3.7:
typedef union _gc_head {
struct {
union _gc_head *gc_next;
union _gc_head *gc_prev;
Py_ssize_t gc_refs;
} gc;
double dummy; /* force worst-case alignment */
} PyGC_Head;
3.8:
typedef struct {
// Pointer to next object in the list.
// 0 means the object is not tracked
uintptr_t _gc_next;
// Pointer to previous object in the list.
// Lowest two bits are used for flags documented later.
uintptr_t _gc_prev;
} PyGC_Head;
In 3.8, the union used to ensure alignment on a C double is gone.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue27987>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com