]> granicus.if.org Git - python/commitdiff
Issue #20354: Fix alignment issue in the tracemalloc module on 64-bit
authorVictor Stinner <victor.stinner@gmail.com>
Sat, 1 Feb 2014 02:43:58 +0000 (03:43 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Sat, 1 Feb 2014 02:43:58 +0000 (03:43 +0100)
platforms. Bug seen on 64-bit Linux when using "make profile-opt".

Only align the "frame_t" structure on 32-bit when Visual Studio is used. Before
the alignment to 32-bit was applied to the whole file any compiler supporting
"#pragma pack(4)" which includes GCC.

Modules/_tracemalloc.c

index f8ce76625181c45b0e2bd2111440ac75356e1c56..42dbeaee0834d68e800b867b1382b3bbe8cef3b0 100644 (file)
@@ -61,10 +61,11 @@ static PyThread_type_lock tables_lock;
    architectures: 12 bytes instead of 16. This optimization might produce
    SIGBUS on architectures not supporting unaligned memory accesses (64-bit
    IPS CPU?): on such architecture, the structure must not be packed. */
-#pragma pack(4)
 typedef struct
 #ifdef __GNUC__
 __attribute__((packed))
+#elif defined(_MSC_VER)
+_declspec(align(4))
 #endif
 {
     PyObject *filename;