On Sun, Apr 19, 2026 at 6:33 AM Bruno Haible via Gnulib discussion list < [email protected]> wrote:
> Since Jim's regex changes from 2026-04-12, the GNU sed continuous > integration > fails when compiled with sanitizers: There is a test failure > > > FAIL: testsuite/dc > ================== > > ../lib/regex_internal.c:1289:7: runtime error: execution reached an > unreachable program point > SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior > ../lib/regex_internal.c:1289:7 in > ../testsuite/dc.sh: line 53: 14403 Done ( echo 2002; > cat easter.dc ) > 14404 Aborted (core dumped) | sed -n -f "$dir/dc.sed" > > easter-out > --- easter-exp 2026-04-19 08:31:22.828781794 +0000 > +++ easter-out 2026-04-19 08:31:22.830781802 +0000 > @@ -1,2 +0,0 @@ > -31 > -March 2002 > > > To make things easier to debug with Gnulib alone (without the GNU sed > sources), > I've extracted the failing scenario and am committing it here into Gnulib. > > The failure is a failed DEBUG_ASSERT (that is not executed in normal > builds). > > This is *not* a regression caused by Jim's and Paul's commits from last > week. > Rather, this assertion failure was already present in the Gnulib code > before > these changes. It was just not seen because on recent glibc systems the > autoconfiguration picked the glibc implementation of the regex code. > Whereas > now, it picks the Gnulib implementation. > > To reproduce the problem: > > $ ./gnulib-tool --create-testdir --dir=../testdir --symlink \ > --avoid=memchr-tests --avoid=strncpy-tests regex > $ cd ../testdir > > With gcc: > export CC="gcc -fsanitize=undefined -fno-sanitize-recover=undefined" > export CFLAGS="-O1 -fno-omit-frame-pointer -ggdb" > > With clang: > export CC="clang > -fsanitize=undefined,signed-integer-overflow,shift,integer-divide-by-zero > -fno-sanitize-recover=undefined" > export CFLAGS="-O1 -fno-omit-frame-pointer -ggdb" > > $ ./configure > $ make > $ make check > > I would suggest to investigate this before the next 'sed' and 'coreutils' > releases. > > > 2026-04-19 Bruno Haible <[email protected]> > > regex tests: Add a test case that triggers an assertion failure. > * tests/test-regex.c (main): Add a test case related to back > references. Nice. Thanks for doing that. The attached just-pushed change resolves this. I tested here (of course) and via grep and sed, each with ubsan.
gnulib-regex-allow-dup-insertion.diff
Description: Binary data
