https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80936
--- Comment #5 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to Martin Sebor from comment #4) > POSIX says this about bcopy: > > For maximum portability, it is recommended to replace the function call to > bcopy() as follows: > > #define bcopy(b1,b2,len) (memmove((b2), (b1), (len)), (void) 0) > > GCC lowers bcopy calls to memmove (and similarly for other bxxx calls), > which I think makes it even more important that the non-null attribute be > applied to their declarations, to detect bugs due to legacy code making the > assumption that bcopy et al are null-safe (e.g., on a target where they > really are). > > $ cat t.c && gcc -O0 -S -Wall -fdump-tree-lower=/dev/stdout t.c > void f (void *d, const void *s, __SIZE_TYPE__ n) > { > __builtin_bcopy (s, 0, n); > } > > ;; Function f (f, funcdef_no=0, decl_uid=1908, cgraph_uid=1, symbol_order=0) > > f (void * d, const void * s, long unsigned int n) > { > __builtin_memmove (0B, s, n); > return; > } ok, be sure to update the comment, then, once you add the attribute