https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97658
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- The compiler is telling you your code has undefined behaviour. If you write code that conforms to the rules of the C++ language, you won't get that warning. Don't change your makefiles, fix your code. I don't see any GCC bug here.