bpo-27987: align PyGC_Head to alignof(long double) (GH-13335) · python/cpython@ea2b76b (original) (raw)
File tree
2 files changed
lines changed
- Misc/NEWS.d/next/Core and Builtins
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -255,7 +255,11 @@ typedef union _gc_head { | ||
255 | 255 | union _gc_head *gc_prev; |
256 | 256 | Py_ssize_t gc_refs; |
257 | 257 | } gc; |
258 | -double dummy; /* force worst-case alignment */ | |
258 | +long double dummy; /* force worst-case alignment */ | |
259 | +// malloc returns memory block aligned for any built-in types and | |
260 | +// long double is the largest standard C type. | |
261 | +// On amd64 linux, long double requires 16 byte alignment. | |
262 | +// See bpo-27987 for more discussion. | |
259 | 263 | } PyGC_Head; |
260 | 264 | |
261 | 265 | extern PyGC_Head *_PyGC_generation0; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
1 | +``PyGC_Head`` structure is aligned to ``long double``. This is needed to | |
2 | +GC-ed objects are aligned properly. Patch by Inada Naoki. |