https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80936

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
         Resolution|INVALID                     |---
      Known to fail|                            |7.3.0, 8.2.0, 9.0

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
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;
}

Reply via email to