[3.7] bpo-27987: align PyGC_Head to alignof(long double) by methane · Pull Request #13335 · python/cpython
@vstinner You wrote:
struct { void *next; void *prev; } _gc;
But it is actually:
struct { void *next; void *prev; ssize_t gc_refs; /* only in Python < 3.8 */ } _gc;
This is very big difference between Python 3.7 and 3.8. That's why I closed PR for 3.8 but don't close this.
sizeof(PyGC_Head) is 12 byte on x86, regardless alignment is double or long double. (I can now "gcc -m32" on Ubuntu, thank you)
On amd64, sizeof(PyGC_Head) is 24 byte with double alignment, and 32byte with long double alignment.
What is the effect of PyListObject for example? Is the address of ob_item aligned to 16 bytes on x86 (32-bit)? Is it on x86-64 (64 bit)?
This pull request affects only where PyObject* ((PyObject*)(gc + 1)) is aligned.
This pull request doesn't affect alignment in PyListObject. offsetof(PyListObject, ob_item) is 24.