• Davi Arnaut's avatar
    Bug#42733: Type-punning warnings when compiling MySQL -- · 21f63caf
    Davi Arnaut authored
               strict aliasing violations.
    
    Another rather noisy violation of strict aliasing rules
    is the spatial code which makes use of stack-based memory
    (of type Geometry_buffer) to provide placement for Geometry
    objects. Although a placement new is allowed to dynamically
    change the type of a object, the object returned by the
    new placement was being ignored and the original stack-based
    object was being casted to the new type, thus violating strict
    aliasing rules.
    
    The solution is to reorganize the code so that the object
    returned by the new placement is used instead of casting the
    original object. Also, to ensure that the stack-based object
    is properly aligned with respect to the objects it provides
    placement for, a set of compiler-dependent macros and types
    are introduced so that the alignment of objects can be inquired
    and specified.
    21f63caf
my_global.h 51.4 KB