File tree 2 files changed +11
-1
lines changed
2 files changed +11
-1
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 @@ -650,8 +650,14 @@ static int running_on_valgrind = -1;
650
650
*
651
651
* You shouldn't change this unless you know what you are doing.
652
652
*/
653
+
654
+ #if SIZEOF_VOID_P > 4
655
+ #define ALIGNMENT 16 /* must be 2^N */
656
+ #define ALIGNMENT_SHIFT 4
657
+ #else
653
658
#define ALIGNMENT 8 /* must be 2^N */
654
659
#define ALIGNMENT_SHIFT 3
660
+ #endif
655
661
656
662
/* Return the number of bytes in size class I, as a uint. */
657
663
#define INDEX2SIZE (I ) (((uint)(I) + 1) << ALIGNMENT_SHIFT)
You can’t perform that action at this time.
0 commit comments