Pádraig Brady <[email protected]> writes:

> Seen with GCC 15.2.1, resulting in the following coreutils failures:
>
>   $ src/printf '%.0f\n' 0
>   lib/vasnprintf.c:875:7: runtime error: null pointer passed as argument 2,
>   which is declared to never be null
>
>   $ src/seq -0 0
>   lib/vasnprintf.c:875:7: runtime error: null pointer passed as argument 2,
>   which is declared to never be null
>
> lib/vasnprintf.c (divide): Avoid the undefined memcpy (..., NULL, 0).
> ---
>  ChangeLog        | 5 +++++
>  lib/vasnprintf.c | 3 ++-
>  2 files changed, 7 insertions(+), 1 deletion(-)

I have just been ignoring this one because it is well-defined in the
upcoming C standard [1]. I assume Bruno probably had the same thought.

We ran into the same issue in glibc, but I don't recall if we made a
decision on adding the conditional.

Collin

[1] 
https://developers.redhat.com/articles/2024/12/11/making-memcpynull-null-0-well-defined


Reply via email to