[Python-checkins] cpython: Issue #20354: Fix alignment issue in the tracemalloc module on 64-bit

victor.stinner python-checkins at python.org
Sat Feb 1 03:54:12 CET 2014


http://hg.python.org/cpython/rev/fb2cdec2c70c
changeset:   88876:fb2cdec2c70c
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sat Feb 01 03:43:58 2014 +0100
summary:
  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.

files:
  Modules/_tracemalloc.c |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c
--- a/Modules/_tracemalloc.c
+++ b/Modules/_tracemalloc.c
@@ -61,10 +61,11 @@
    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;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list