# HG changeset patch # User Victor Stinner # Date 1418386661 -3600 # Node ID adb44557899500bfdc4af04b1fa0bf17bc95731e # Parent d633fa3f12093279a9baa2f27f17e115c609e764 Issue #18028: Fix aliasing issue in READ_TIMESTAMP() of ceval.c on x86_64, when Python is configure with --with-tsc. Patch written by Christian Heimes. diff --git a/Python/ceval.c b/Python/ceval.c --- a/Python/ceval.c +++ b/Python/ceval.c @@ -65,9 +65,11 @@ ppc_getcounter(uint64 *v) even in 64-bit mode, we need to use "a" and "d" for the lower and upper 32-bit pieces of the result. */ -#define READ_TIMESTAMP(val) \ - __asm__ __volatile__("rdtsc" : \ - "=a" (((int*)&(val))[0]), "=d" (((int*)&(val))[1])); +#define READ_TIMESTAMP(val) do { \ + unsigned int h, l; \ + __asm__ __volatile__("rdtsc" : "=a" (l), "=d" (h)); \ + (val) = ((uint64)l) | (((uint64)h) << 32); \ + } while(0) #else