https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38274
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note if you want to detect more buffer overruns you should try -fsanitize=address . Valgrind will also detect more too. BUT note none of these are 100% either because they only have a limited redzone and valgrind also will detect less due to if two buffers are on the stack there is no zone inbetween the buffers.