Hi, Dmitri A. Sergatskov wrote: > When Octave (which uses gnulib) is compiled with UBSAN I see the following > while running its test suite: > > ../../libgnu/unistr/u8-to-u16.c:80:34: runtime error: applying zero offset > to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior > ../../libgnu/unistr/u8-to-u16.c:80:34 > ../../libgnu/unistr/u16-to-u8.c:80:33: runtime error: applying zero offset > to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior > ../../libgnu/unistr/u16-to-u8.c:80:33
These Gnulib modules use a feature that has only recently been standardized as valid in ISO C [1]. Work is underway in glibc, gcc, and clang, to avoid the now-unjustified UBSAN reports [2][3][4]. Until then, your best remedy is to pass the following options to your gnulib-tool invocation(s): --avoid=memchr-tests \ --avoid=strncat-tests \ --avoid=unicase/u8-casecmp-tests \ --avoid=unicase/u8-casecoll-tests \ --avoid=unicase/u8-casefold-tests \ --avoid=unicase/u8-tolower-tests \ --avoid=unicase/u8-totitle-tests \ --avoid=unicase/u8-toupper-tests \ --avoid=unicase/u16-casecmp-tests \ --avoid=unicase/u16-casecoll-tests \ --avoid=unicase/u16-casefold-tests \ --avoid=unicase/u16-tolower-tests \ --avoid=unicase/u16-totitle-tests \ --avoid=unicase/u16-toupper-tests \ --avoid=unicase/u32-casecmp-tests \ --avoid=unicase/u32-casecoll-tests \ --avoid=unicase/u32-casefold-tests \ --avoid=unicase/u32-tolower-tests \ --avoid=unicase/u32-totitle-tests \ --avoid=unicase/u32-toupper-tests \ --avoid=unilbrk/u8-width-linebreaks-tests \ --avoid=unilbrk/u16-width-linebreaks-tests \ --avoid=unilbrk/u32-width-linebreaks-tests \ --avoid=uninorm/nfc-tests \ --avoid=uninorm/nfd-tests \ --avoid=uninorm/nfkc-tests \ --avoid=uninorm/nfkd-tests \ --avoid=uninorm/u8-normcmp-tests \ --avoid=uninorm/u8-normcoll-tests \ --avoid=uninorm/u16-normcmp-tests \ --avoid=uninorm/u16-normcoll-tests \ --avoid=uninorm/u32-normcmp-tests \ --avoid=uninorm/u32-normcoll-tests \ --avoid=unistdio/u8-vasnprintf-tests \ --avoid=unistdio/u8-vasprintf-tests \ --avoid=unistdio/u16-vasnprintf-tests \ --avoid=unistdio/u16-vasprintf-tests \ --avoid=unistdio/u32-vasnprintf-tests \ --avoid=unistdio/u32-vasprintf-tests \ --avoid=unistdio/ulc-vasnprintf-tests \ --avoid=unistdio/ulc-vasprintf-tests \ --avoid=unistr/u8-chr-tests \ --avoid=unistr/u8-strchr-tests \ --avoid=unistr/u8-to-u16-tests \ --avoid=unistr/u8-to-u32-tests \ --avoid=unistr/u16-chr-tests \ --avoid=unistr/u16-strchr-tests \ --avoid=unistr/u16-to-u32-tests \ --avoid=unistr/u16-to-u8-tests \ --avoid=unistr/u32-to-u16-tests \ --avoid=unistr/u32-to-u8-tests \ Bruno [1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf [2] https://sourceware.org/bugzilla/show_bug.cgi?id=32286 [3] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117023 [4] https://github.com/llvm/llvm-project/issues/95889