Skip to content
  • Davi Arnaut's avatar
    bb036c93
    Bug#42733: Type-punning warnings when compiling MySQL -- · bb036c93
    Davi Arnaut authored
               strict aliasing violations.
    
    Essentially, the problem is that large parts of the server were
    developed in simpler times (last decades, pre C99 standard) when
    strict aliasing and compilers supporting such optimizations were
    rare to non-existent. Thus, when compiling the server with a modern
    compiler that uses strict aliasing rules to perform optimizations,
    there are several places in the code that might trigger undefined
    behavior.
    
    As evinced by some recent bugs, GCC does a somewhat good of job
    misoptimizing such code, but on the other hand also gives warnings
    about suspicious code. One problem is that the warnings aren't
    always accurate, yet we can't afford to just shut them off as we
    might miss real cases. False-positive cases are aggravated mostly
    by casts that are likely to trigger undefined behavior.
    
    The solution is to start a cleanup process focused on fixing and
    reducing the amount of strict-aliasing related warnings produced
    by GCC and others compilers. A good deal of noise reduction can
    be achieved by just removing useless casts that are product of
    historical cruft and are likely to trigger undefined behavior if
    dereferenced.
    bb036c93
    Bug#42733: Type-punning warnings when compiling MySQL --
    Davi Arnaut authored
               strict aliasing violations.
    
    Essentially, the problem is that large parts of the server were
    developed in simpler times (last decades, pre C99 standard) when
    strict aliasing and compilers supporting such optimizations were
    rare to non-existent. Thus, when compiling the server with a modern
    compiler that uses strict aliasing rules to perform optimizations,
    there are several places in the code that might trigger undefined
    behavior.
    
    As evinced by some recent bugs, GCC does a somewhat good of job
    misoptimizing such code, but on the other hand also gives warnings
    about suspicious code. One problem is that the warnings aren't
    always accurate, yet we can't afford to just shut them off as we
    might miss real cases. False-positive cases are aggravated mostly
    by casts that are likely to trigger undefined behavior.
    
    The solution is to start a cleanup process focused on fixing and
    reducing the amount of strict-aliasing related warnings produced
    by GCC and others compilers. A good deal of noise reduction can
    be achieved by just removing useless casts that are product of
    historical cruft and are likely to trigger undefined behavior if
    dereferenced.
Loading