From: Paul Eggert Date: Wed, 5 Nov 2025 21:32:48 +0000 (-0800) Subject: doc: NULL + 0 updates for C23 and Clang 20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47f0d3ce9354afed95c595dc11a4957bc8fd64f9;p=thirdparty%2Fgnulib.git doc: NULL + 0 updates for C23 and Clang 20 --- diff --git a/doc/gnulib-intro.texi b/doc/gnulib-intro.texi index 8c4e803d0d..d07dbcacae 100644 --- a/doc/gnulib-intro.texi +++ b/doc/gnulib-intro.texi @@ -306,12 +306,13 @@ all practical POSIX or C platforms. @itemize @bullet @item -Clang's @option{-fsanitize=undefined} option causes the program to -crash if it adds zero to a null pointer -- behavior that is undefined -in strict C, but which yields a null pointer on all practical porting -targets and which the Gnulib portability guidelines allow. +In Clang 19 and earlier, the @option{-fsanitize=undefined} option +causes the program to crash if it adds zero to a null pointer -- +behavior that is undefined in strict C17 and earlier, but which yields +a null pointer in C23 and later and on all practical porting targets, +and which the Gnulib portability guidelines allow. -If you use Clang with @option{-fsanitize=undefined}, you can work +If you use Clang 19 or earlier with @option{-fsanitize=undefined}, you can work around the problem by also using @samp{-fno-sanitize=pointer-overflow}, although this may also disable some unrelated and useful pointer checks. Perhaps someday the Clang developers will fix the infelicity. diff --git a/doc/gnulib-readme.texi b/doc/gnulib-readme.texi index 9066949645..37a740a007 100644 --- a/doc/gnulib-readme.texi +++ b/doc/gnulib-readme.texi @@ -318,8 +318,8 @@ general Gnulib portability guidelines. Currently Gnulib assumes at least a freestanding C99 compiler, possibly operating with a C library that predates C99; with time this assumption will likely be strengthened to later versions of the C -standard. Old platforms currently supported include AIX 6.1, HP-UX -11i v1 and Solaris 10, though these platforms are rarely tested. +standard. Old platforms currently supported include AIX 7.3 +and Solaris 10, though these platforms are rarely tested. Gnulib itself is so old that it contains many fixes for obsolete platforms, fixes that may be removed in the future. @@ -564,9 +564,10 @@ Adding zero to a null pointer does not change the pointer. For example, @code{0 + (char *) NULL == (char *) NULL}. Similarly, subtracting zero does not change a null pointer, and subtracting two null pointers results in zero. -A future C standard is planned to require this behavior; see +C23 was the first C standard to require this behavior; see ``@url{https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf, -Allow zero length operations on null pointers}'', WG14 N3322 (2024-08-28). +Allow zero length operations on null pointers}'', WG14 N3322 (2024-08-28); +which was adopted retroactively for C23. @end itemize @end itemize