diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-12-12 12:17:41 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-12-12 12:17:41 (GMT) |
commit | 0b881dd50f38ef3215aa5093d57b353440bba076 (patch) | |
tree | d40a15f24a96f7b54c48843089e72b5774801e11 /Python | |
parent | 437ffbdcd8b7819af256f4e1b0a674f7612e8f30 (diff) | |
download | cpython-0b881dd50f38ef3215aa5093d57b353440bba076.zip cpython-0b881dd50f38ef3215aa5093d57b353440bba076.tar.gz cpython-0b881dd50f38ef3215aa5093d57b353440bba076.tar.bz2 |
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.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index bafb88c..118f2b7 100644 --- 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 |