diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-02-01 02:43:58 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-02-01 02:43:58 (GMT) |
commit | dd382ef8ec8a572f202999ca94ff292722f3d6f6 (patch) | |
tree | b8252af52e0e02e2661598d3f0f9dc94c4ed2090 /Modules/_tracemalloc.c | |
parent | a17b6bb5fe6a3e12ef359cc4c214cf7a7785bd88 (diff) | |
download | cpython-dd382ef8ec8a572f202999ca94ff292722f3d6f6.zip cpython-dd382ef8ec8a572f202999ca94ff292722f3d6f6.tar.gz cpython-dd382ef8ec8a572f202999ca94ff292722f3d6f6.tar.bz2 |
Issue #20354: Fix alignment issue in the tracemalloc module on 64-bit
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.
Diffstat (limited to 'Modules/_tracemalloc.c')
-rw-r--r-- | Modules/_tracemalloc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index f8ce766..42dbeae 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -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; |