[New-bugs-announce] [issue15992] Strict aliasing violations in Objects/unicodeobject.c
report at bugs.python.org
Thu Sep 20 22:16:59 CEST 2012
New submission from Mark Dickinson:
[Broken out of the discussion in issue 15144]
Some of the newly-optimized code in Objects/unicodeobject.c contains strict aliasing violations; under the C standards, this is undefined behaviour (C99 6.5p7).
An example occurs in ascii_decode:
unsigned long value = *(const unsigned long *) _p;
Here the pointer dereference violates the strict aliasing rule.
I think these portions of Objects/unicodeobject.c should be rewritten to avoid the undefined behaviour.
This is not a purely theoretical problem: compilers are known to make optimizations based on the assumption that strict aliasing is not violated. Early versions of David Gay's dtoa.c gave incorrect results as a result of strict aliasing violations, for example; see .
 gives a stackoverflow reference explaining strict aliasing.
components: Interpreter Core
nosy: mark.dickinson, storchaka
title: Strict aliasing violations in Objects/unicodeobject.c
versions: Python 3.3
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce