STINNER Victor <vstin...@python.org> added the comment:

Objects/obmalloc.c currently relies on the SIZEOF_VOID_P macro:
---
#if SIZEOF_VOID_P > 4
#define ALIGNMENT              16               /* must be 2^N */
#define ALIGNMENT_SHIFT         4
#else
#define ALIGNMENT               8               /* must be 2^N */
#define ALIGNMENT_SHIFT         3
#endif
---

If we want to respect sizeof(max_align_t) alignment, we can compute 
sizeof(max_align_t) in configure and uses the result in obmalloc.c. I expect 
that it's either 16 or 32, so we can maybe just hardcode ALIGNMENT_SHIFT using 
something like: "if == 32 ... #elif == 16 ... #else #error ...".

On x86 (32-bit) Fedora 35, gcc says 48 for sizeof(max_align_t) which is way 
larger than the current alignment to 8 bytes!

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue47179>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to