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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-01-15
                 CC|                            |dmalcolm at gcc dot gnu.org,
                   |                            |iains at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
The reason for the failure is that the darwin headers, in <secure/_string.h>
(included from <string.h>), defines memcpy like this:

#if __has_builtin(__builtin___memcpy_chk) || defined(__GNUC__)
#undef memcpy
/* void *memcpy(void *dst, const void *src, size_t n) */
#define memcpy(dest, ...) \
               __builtin___memcpy_chk (dest, __VA_ARGS__, __darwin_obsz0
(dest))
#endif

where __darwin_obsz0 is defined thusly:

#define __darwin_obsz0(object) __builtin_object_size (object, 0)



So either the testcase should be modified to use __builtin_memcpy, or the
analyzer should handle __builtin___memcpy_chk and emit the right warning.

Reply via email to