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

--- Comment #14 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #13)
> static inline void copy (const char *p)
> {
>   int N = null_safe_strlen (p);
>   if (N) /* disabling this branch prevents the warning */
>     __builtin_memcpy (sink, p, N);
>   else
>     *sink = 0;
> }

This testcase is importantly different from mine; in mine the branch itself is
what introduces the range information that causes the warning, we only decide
that the statement is invalid because of the if.  In your testcase, if you made
the memcpy unconditional we would still warn; in mine we only warn *because*
it's conditional.

Reply via email to