https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70514
--- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Chris Warrick from comment #5) > Thanks for debugging my code, and sorry for wasting time. No problem. It is a pity that GCC static analysis capabilities are not powerful enough to catch this case, but -fsanitize is your friend. Perhaps useful: https://gcc.gnu.org/wiki/FAQ#misoptimization