No simpler C code is (yet) known to hit this. On request will describe actual package where similar code occurs.
In the attached preprocessed code, incorrect arg 3, `%rdx', is passed to `handle_out_external'. Code expects this value, `extlen', to be the same as value that is returned from `__builtin_alloca', stored in `c', passed to `memcpy' as arg 1. It is not. Instead, the following assembler code is output. movq %rbx, %rdi call memcpy movq -72(%rbp), %rcx movq -40(%rbp), %rdx movq %rbx, -40(%rbp) It passes in `%rbx' uninitialized value that was in `-40(%rbp)' and only then writes into `-40(%rbp)' the correct value to pass. Observing when compiling not only `-O3', but even `-fno-strict-aliasing -O3 -fno-strict-aliasing'. In these 2 invocations assembler output is the same. That is, `-fno-strict-aliasing' no longer disables optimizations that require strict aliasing rules in code. It, however, disables warnings output when `-Wstrict-aliasing=2' is specified. -- Summary: wrong code for dereferencing type-punned pointer Product: gcc Version: 4.2.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gin at mo dot msk dot ru GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34803