[all-commits] [llvm/llvm-project] 8c7416: [SimplifyLibCalls] Don't mark memchr() memory as f...
Nikita Popov via All-commits
all-commits at lists.llvm.org
Wed Apr 13 07:46:34 PDT 2022
Author: Nikita Popov <npopov at redhat.com>
Date: 2022-04-13 (Wed, 13 Apr 2022)
[SimplifyLibCalls] Don't mark memchr() memory as fully dereferenceable
C11 specifies memchr() as follows:
> The memchr function locates the first occurrence of c (converted
> to an unsigned char) in the initial n characters (each interpreted
> as unsigned char) of the object pointed to by s. The implementation
> shall behave as if it reads the characters sequentially and stops
> as soon as a matching character is found.
In particular, it is well-defined to specify a memchr size larger
than the underlying object, as long as the character is found before
the end of the object.
Differential Revision: https://reviews.llvm.org/D123665
More information about the All-commits