https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99623
Sebastiano Vigna <sebastiano.vigna at unimi dot it> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #7 from Sebastiano Vigna <sebastiano.vigna at unimi dot it> --- Thank you for the prompt answer. It is all very weird, and certainly unexpected, but this could be a problem with GNU libavl. The four assignments marked by -Wstrict-aliasing=2 are completely wrong: there is an additional & that shouldn't be there. Since this is a GNU library with two decades of development behind, we did not check in particular the code we did not change. If we remove the &, the warnings go away and the problem disappears. Adding some assertions we established that the nonsensical assignment are, simply, never executed. This is why, in spite of being nonsensical, they do not cause any harm. But their very existence, even if they are not executed, appears to trigger the problem we faced with -O2. I guess that once you have undefined statements all bets are off, so this is not a gcc bug. We will report the problem to the libavl authors.