https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80346
--- Comment #16 from Martin Sebor <msebor at gcc dot gnu.org> --- Interestingly, GCC manages to eliminate the memset at -O1 (and thus avoid warning) but not at -O2: $ gcc -O1 -S -Wall -Wextra -Wpedantic -fdump-tree-optimized=/dev/stdout ../b.c ;; Function f (f, funcdef_no=0, decl_uid=1799, cgraph_uid=0, symbol_order=0) f (void * d, const char * s, size_t a, size_t b) { <bb 2> [100.00%]: return; } ;; Function g (g, funcdef_no=1, decl_uid=1804, cgraph_uid=1, symbol_order=1) g (void * d, const char * s, size_t b) { <bb 2> [100.00%]: return; }