]> Savannah Git Hosting - gnulib.git/commitdiff
Document clang -fsanitize=undefined glitch
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 Feb 2022 19:39:32 +0000 (11:39 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 26 Feb 2022 19:39:46 +0000 (11:39 -0800)
* doc/gnulib-intro.texi (Unsupported Platforms):
Document incompatibility of ‘clang -fsanitize=undefined’
with Gnulib, and how to work around it by also using
‘-fno-sanitize=pointer-overflow’.

ChangeLog
doc/gnulib-intro.texi

index 6daf85da3e8bcb35305e9906e98f8a5c645627ce..430f81fd39816bef92430be5b308ff36ebca6bdd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-02-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Document clang -fsanitize=undefined glitch
+       * doc/gnulib-intro.texi (Unsupported Platforms):
+       Document incompatibility of ‘clang -fsanitize=undefined’
+       with Gnulib, and how to work around it by also using
+       ‘-fno-sanitize=pointer-overflow’.
+
 2022-02-25  Darshit Shah  <darnir@gnu.org>
 
        modules/unicase/special-casing: Fix compilation error
index a80c0995f5b86a001d46ace80d7639410fdef789..0bc9701561c4c6985147239f1c8ef74b7e4a009e 100644 (file)
@@ -235,6 +235,17 @@ and Gnulib-using code would have if it were intended to be portable to
 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.
+
+If you use Clang 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.
+
 @item
 The IBM i's pointers are 128 bits wide and it lacks the two types
 @code{intptr_t} and @code{uintptr_t}, which are optional in the C and