Fix for over-aligned GC info
Patch by Florian Weimer
See: https://bugzilla.redhat.com/show_bug.cgi?id=1540316
Upstream discussion: https://mail.python.org/pipermail/python-dev/2018-January/152000.html
diff --git a/Include/objimpl.h b/Include/objimpl.h
index 55e83eced6..aa906144dc 100644
a
|
b
|
PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t); |
248 | 248 | /* for source compatibility with 2.2 */ |
249 | 249 | #define _PyObject_GC_Del PyObject_GC_Del |
250 | 250 | |
| 251 | /* Former over-aligned definition of PyGC_Head, used to compute the |
| 252 | size of the padding for the new version below. */ |
| 253 | union _gc_head; |
| 254 | union _gc_head_old { |
| 255 | struct { |
| 256 | union _gc_head *gc_next; |
| 257 | union _gc_head *gc_prev; |
| 258 | Py_ssize_t gc_refs; |
| 259 | } gc; |
| 260 | long double dummy; |
| 261 | }; |
| 262 | |
251 | 263 | /* GC information is stored BEFORE the object structure. */ |
252 | 264 | typedef union _gc_head { |
253 | 265 | struct { |
… |
… |
typedef union _gc_head { |
255 | 267 | union _gc_head *gc_prev; |
256 | 268 | Py_ssize_t gc_refs; |
257 | 269 | } gc; |
258 | | long double dummy; /* force worst-case alignment */ |
| 270 | double dummy; /* force worst-case alignment */ |
| 271 | char dummy_padding[sizeof(union _gc_head_old)]; |
259 | 272 | } PyGC_Head; |
260 | 273 | |
261 | 274 | extern PyGC_Head *_PyGC_generation0; |