Re: undefined-behavior obstack.c:139
Marc Nieper-Wißkirchen <[email protected]> Fri, 1 Dec 2023 21:36:36 +0100
| Newsgroups | gmane.comp.lib.gnulib.bugs,gmane.comp.gnu.m4.bugs |
|---|---|
| Message-ID | <CAEYrNrR7+EMpV1Kek0_Oyg8ttHJrQvE0Np_ubQf6ndy6jknR6Q@mail.gmail.com> |
Am Fr., 1. Dez. 2023 um 21:01 Uhr schrieb Paul Eggert <[email protected]>: > On 2023-12-01 10:40, Bruno Haible wrote: > > > Indeed, this sentence appears to forbid ((char *) NULL) + something. > > Yes. However, Gnulib code can still use ((char *) NULL) + something) > because the Gnulib portability guidelines allow it. > > The issue with clang false positives is covered here: > > > https://www.gnu.org/software/gnulib/manual/html_node/Unsupported-Platforms.html > > which lists "clang -fsanitize=undefined" as an unsupported platform > unless you also specify "-fno-sanitize=pointer-overflow". > > The obstack patch you installed is fine, as it's clearer and just as > fast as the original. However, we needn't go through Gnulib and change > other code merely because it runs afoul of this false alarm from clang. > It may not be a false alarm in future versions of the compiler. At any time, the compiler may decide to replace ((char *) NULL + 0) by __builtin_unreachable. It can make sense to find an ISO C-compliant replacement of this idiom at some point.