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

--- Comment #1 from Jamie Bainbridge <jamie.bainbridge at gmail dot com> ---
Thanks for logging this!

(In reply to David Malcolm from comment #0)
> - complain about NULL passed as the string to the first call of strtok
> reached from entry to "main" (I don't think there's a guarantee that strtok
> checks for this).

UNIX libc (since BSD 4.3 or earlier) and musl (since always) check for this and
return NULL, but glibc intentionally crashes as a form of UB detection. Further
discussion of glibc behaviour at:

 https://sourceware.org/bugzilla/show_bug.cgi?id=16640
 https://sourceware.org/pipermail/libc-alpha/2022-November/143337.html

As we discussed via email, C99 and later have contained:

> The first call in the sequence has a non-null first argument;

Reply via email to