Subject: Test suite failure (testsuite/debug) with UBSAN

From: Sam James <[email-masked]>
Date: Sat, 31 Dec 2022 22:08:10 +0000

Hi folks,

When running sed 4.9's test suite with -fsanitize=undefined (UBSAN), I get the following
from make check:
```
FAIL: testsuite/debug
=====================

PATH = /var/tmp/portage/sys-apps/sed-4.9/work/sed-4.9/sed:/var/tmp/portage/sys-apps/sed-4.9/temp/clang-wrappers:/usr/lib/ccache/bin:/usr/lib/portage/python3.11/ebuild-helpers/xattr:/usr/lib/portage/python3.11/ebuild-helpers:/usr/sbin:/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/16/bin:/usr/lib/llvm/15/bin:/usr/lib/llvm/14/bin:/var/qmail/bin
debug.pl: test c10_: stderr mismatch, comparing c10_.3 (expected) and c10_.E (actual)
*** c10_.3      Sat Dec 31 22:06:23 2022
--- c10_.E      Sat Dec 31 22:06:23 2022
***************
*** 0 ****
--- 1,9 ----
+ sed/debug.c:322:7: runtime error: null pointer passed as argument 1, which is declared to never be null
+     #0 0x561c777a5ff5 in debug_print_function sed/debug.c:322
+     #1 0x561c777a6777 in debug_print_command sed/debug.c:437
+     #2 0x561c777a68e1 in debug_print_program sed/debug.c:454
+     #3 0x561c777b65ae in main sed/sed.c:376
+     #4 0x7fdadb27c64f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
+     #5 0x7fdadb27c708 in __libc_start_main_impl ../csu/libc-start.c:381
+     #6 0x561c77798f34 in _start ../sysdeps/x86_64/start.S:115
+
FAIL testsuite/debug.pl (exit status: 1)
```

This is with GCC 12.2.1_p20221224.

Best,
sam