>From 140aff1babcfa58d49c9f60ed61b9c7720e6b1c5 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 5 Nov 2024 21:11:14 +0100 Subject: [PATCH 12/23] memchr tests: Verify N3322 functionality. * tests/test-memchr.c (main): Add a zero-size test. --- ChangeLog | 5 +++++ tests/test-memchr.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 699893401b..5748bc9fe6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2024-11-05 Bruno Haible + + memchr tests: Verify N3322 functionality. + * tests/test-memchr.c (main): Add a zero-size test. + 2024-11-05 Bruno Haible strncmp tests: Verify N3322 functionality. diff --git a/tests/test-memchr.c b/tests/test-memchr.c index 9111371a15..ffa3a0ac2c 100644 --- a/tests/test-memchr.c +++ b/tests/test-memchr.c @@ -133,5 +133,12 @@ main (void) free (input); + /* Test zero-length operations on NULL pointers, allowed by + . */ + { + int volatile value = (memchr (NULL, '?', 0) == NULL); + ASSERT (value); + } + return test_exit_status; } -- 2.34.1