[PATCH] D86993: Document Clang's expectations of the C standard library.

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 10:51:40 PDT 2023


xbolva00 added a comment.

In D86993#4474403 <https://reviews.llvm.org/D86993#4474403>, @RalfJung wrote:

> Yeah, agreed. Though I hear that GCC makes similar assumptions, so this should count as something I think. (I don't have a source for this, so it should probably be verified.)

glibc's header files mark the pointer as non-null:
extern void *memcpy (void *restrict dest, const void *restrict src,

size_t __n) throw () __attribute__ ((__nonnull__ (1, 2)));
c99: 7.21.2.1 "The memcpy function copies n characters from the object pointed to by s2 into the
object pointed to by s1. If copying takes place between objects that overlap, the behavior
is undefined."

null is not a pointer to an object


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86993/new/

https://reviews.llvm.org/D86993



More information about the cfe-commits mailing list