2024-11-20 Paul Eggert <eggert@cs.ucla.edu>
+ tests: dissuade unwanted clang optimization
+ Pacify Apple clang 14.0.0 (clang-1400.0.29.202) for
+ arm64-apple-darwin21.6.0 on test-memset_explicit.c,
+ which otherwise complains “warning: null passed to a callee that
+ requires a non-null argument [-Wnonnull]” and presumably could
+ do an unwanted optimization based on this analysis.
+ Do other tests consistently.
+ * tests/test-bsearch.c (lib_bsearch, volatile_bsearch, bsearch):
+ * tests/test-memccpy.c (lib_memccpy, volatile_memccpy, memccpy):
+ * tests/test-memchr.c (lib_memchr, volatile_memchr, memchr):
+ * tests/test-memcmp.c (lib_memcmp, volatile_memcmp, memcmp):
+ * tests/test-memcpy.c (lib_memcpy, volatile_memcpy, memcpy):
+ * tests/test-memmove.c (lib_memmove, volatile_memmove, memmove):
+ * tests/test-memset.c (lib_memset, volatile_memset, memset):
+ * tests/test-memset_explicit.c (lib_memset_explicit)
+ (volatile_memset_explicit, memset_explicit):
+ * tests/test-qsort.c (lib_qsort, volatile_qsort, qsort):
+ * tests/test-strncat.c (lib_strncat, volatile_strncat, strncat):
+ * tests/test-strncmp.c (lib_strncmp, volatile_strncmp, strncmp):
+ * tests/test-strncpy.c (lib_strncpy, volatile_strncpy, strncpy):
+ * tests/test-strndup.c (lib_strndup, volatile_strndup, strndup):
+ * tests/test-wcsncat.c (lib_wcsncat, volatile_wcsncat, wcsncat):
+ * tests/test-wcsncmp.c (lib_wcsncmp, volatile_wcsncmp, wcsncmp):
+ * tests/test-wcsncpy.c (lib_wcsncpy, volatile_wcsncpy, wcsncpy):
+ * tests/test-wmemchr.c (lib_wmemchr, volatile_wmemchr, wmemchr):
+ * tests/test-wmemcmp.c (lib_wmemcmp, volatile_wmemcmp, wmemcmp):
+ * tests/test-wmemcpy.c (lib_wmemcpy, volatile_wmemcpy, wmemcpy):
+ * tests/test-wmemmove.c (lib_wmemmove, volatile_wmemmove, wmemmove):
+ * tests/test-wmemset.c (lib_wmemset, volatile_wmemset, wmemset)
+ Convince the compiler to not optimize based on what it thinks
+ about the function. Callers changed to not use volatile locals,
+ since they should no longer be needed.
+
openat: omit unnecessary fd test
* lib/openat.c (openat_permissive): Close fd regardless
of whether it’s STDERR_FILENO. This saves a bit of code space
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static void *
+lib_bsearch (void const *key, void const *base, size_t nel, size_t width,
+ int (*compar) (void const *, void const *))
+{
+ return bsearch (key, base, nel, width, compar);
+}
+static void *(*volatile volatile_bsearch) (void const *, void const *, size_t,
+ size_t,
+ int (*) (void const *, void const *))
+ = lib_bsearch;
+#undef bsearch
+#define bsearch volatile_bsearch
+
static int
cmp (const void *a, const void *b)
{
int
main (void)
{
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
-
- value = (bsearch ("x", NULL, 0, 1, cmp) == NULL);
- ASSERT (value);
+ ASSERT (bsearch ("x", NULL, 0, 1, cmp) == NULL);
return test_exit_status;
}
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static void *
+lib_memccpy (void *dest, void const *src, int c, size_t n)
+{
+ return memccpy (dest, src, c, n);
+}
+static void *(*volatile volatile_memccpy) (void *, void const *, int, size_t)
+ = lib_memccpy;
+#undef memccpy
+#define memccpy volatile_memccpy
+
int
main (void)
{
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- value = (memccpy (NULL, "x", '?', 0) == NULL);
- ASSERT (value);
+ ASSERT (memccpy (NULL, "x", '?', 0) == NULL);
{
char y[1];
- value = (memccpy (y, NULL, '?', 0) == NULL);
- ASSERT (value);
+ ASSERT (memccpy (y, NULL, '?', 0) == NULL);
}
return test_exit_status;
#include "zerosize-ptr.h"
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static void *
+lib_memchr (void const *s, int c, size_t n)
+{
+ return memchr (s, c, n);
+}
+static void *(*volatile volatile_memchr) (void const *, int, size_t)
+ = lib_memchr;
+#undef memchr
+#define memchr volatile_memchr
+
/* Calculating void * + int is not portable, so this wrapper converts
to char * to make the tests easier to write. */
#define MEMCHR (char *) memchr
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- {
- int volatile value = (memchr (NULL, '?', 0) == NULL);
- ASSERT (value);
- }
+ ASSERT (memchr (NULL, '?', 0) == NULL);
return test_exit_status;
}
#include "zerosize-ptr.h"
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static int
+lib_memcmp (void const *s1, void const *s2, size_t n)
+{
+ return memcmp (s1, s2, n);
+}
+int (*volatile volatile_memcmp) (void const *, void const *, size_t)
+ = lib_memcmp;
+#undef memcmp
+#define memcmp volatile_memcmp
+
int
main (void)
{
- int (* volatile memcmp_ptr) (const void *, const void *, size_t) = memcmp;
-
/* Test equal / not equal distinction. */
void *page_boundary1 = zerosize_ptr ();
void *page_boundary2 = zerosize_ptr ();
ASSERT (memcmp ("foobar", "foo", 4) > 0);
/* Some old versions of memcmp were not 8-bit clean. */
- /* Use the function pointer here, because otherwise this test is sometimes
- miscompiled by 'clang'.
- See <https://bugs.llvm.org/show_bug.cgi?id=40063>. */
- ASSERT (memcmp_ptr ("\100", "\201", 1) < 0);
- ASSERT (memcmp_ptr ("\201", "\100", 1) > 0);
- ASSERT (memcmp_ptr ("\200", "\201", 1) < 0);
- ASSERT (memcmp_ptr ("\201", "\200", 1) > 0);
+ ASSERT (memcmp ("\100", "\201", 1) < 0);
+ ASSERT (memcmp ("\201", "\100", 1) > 0);
+ ASSERT (memcmp ("\200", "\201", 1) < 0);
+ ASSERT (memcmp ("\201", "\200", 1) > 0);
/* The Next x86 OpenStep bug shows up only when comparing 16 bytes
or more and with at least one buffer not starting on a 4-byte boundary.
}
}
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
-
- value = (memcmp (NULL, "x", 0) == 0);
- ASSERT (value);
-
- value = (memcmp ("x", NULL, 0) == 0);
- ASSERT (value);
-
- value = (memcmp (NULL, NULL, 0) == 0);
- ASSERT (value);
+ ASSERT (memcmp (NULL, "x", 0) == 0);
+ ASSERT (memcmp ("x", NULL, 0) == 0);
+ ASSERT (memcmp (NULL, NULL, 0) == 0);
return test_exit_status;
}
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static void *
+lib_memcpy (void *s1, void const *s2, size_t n)
+{
+ return memcpy (s1, s2, n);
+}
+void *(*volatile volatile_memcpy) (void *, void const *, size_t)
+ = lib_memcpy;
+#undef memcpy
+#define memcpy volatile_memcpy
+
int
main (void)
{
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- value = (memcpy (NULL, "x", 0) == NULL);
- ASSERT (value);
+ ASSERT (memcpy (NULL, "x", 0) == NULL);
{
char y[1];
- value = (memcpy (y, NULL, 0) == y);
- ASSERT (value);
+ ASSERT (memcpy (y, NULL, 0) == y);
}
return test_exit_status;
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static void *
+lib_memmove (void *s1, void const *s2, size_t n)
+{
+ return memmove (s1, s2, n);
+}
+static void *(*volatile volatile_memmove) (void *, void const *, size_t)
+ = lib_memmove;
+#undef memmove
+#define memmove volatile_memmove
+
int
main (void)
{
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- value = (memmove (NULL, "x", 0) == NULL);
- ASSERT (value);
+ ASSERT (memmove (NULL, "x", 0) == NULL);
{
char y[1];
- value = (memmove (y, NULL, 0) == y);
- ASSERT (value);
+ ASSERT (memmove (y, NULL, 0) == y);
}
return test_exit_status;
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static void *
+lib_memset (void *s, int c, size_t n)
+{
+ return memset (s, c, n);
+}
+static void *(*volatile volatile_memset) (void *, int, size_t)
+ = lib_memset;
+#undef memset
+#define memset volatile_memset
+
int
main (void)
{
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- {
- int volatile value = (memset (NULL, '?', 0) == NULL);
- ASSERT (value);
- }
+ ASSERT (memset (NULL, '?', 0) == NULL);
return test_exit_status;
}
/* Enable this to verify that the test is effective. */
#if 0
-# define memset_explicit(a, c, n) memset (a, c, n)
+# undef memset_explicit
+# define memset_explicit memset
#endif
+/* Test the library, not the compiler+library. */
+static void *
+lib_memset_explicit (void *s, int c, size_t n)
+{
+ return memset_explicit (s, c, n);
+}
+static void *(*volatile volatile_memset_explicit) (void *, int, size_t)
+ = lib_memset_explicit;
+#undef memset_explicit
+#define memset_explicit volatile_memset_explicit
+
/* Suppress GCC 13.2.1 false alarm, as this test needs a dangling pointer. */
#if _GL_GNUC_PREREQ (12, 0)
# pragma GCC diagnostic ignored "-Wdangling-pointer"
{
char *heapbuf = (char *) malloc (SECRET_SIZE);
ASSERT (heapbuf);
- uintptr_t volatile addr = (uintptr_t) heapbuf;
+ uintptr_t addr = (uintptr_t) heapbuf;
memcpy (heapbuf, SECRET, SECRET_SIZE);
memset_explicit (heapbuf, 0, SECRET_SIZE);
free (heapbuf);
1. Put a secret in memory and invoke memset_explicit on it.
2. Verify that the memory has been erased.
Implement them in the same function, so that they access the same memory
- range on the stack. Declare the local scalars to be volatile so they
- are not optimized away. That way, the test verifies that the compiler
+ range on the stack. That way, the test verifies that the compiler
does not eliminate a call to memset_explicit, even if data flow analysis
reveals that the stack area is dead at the end of the function. */
static bool _GL_ATTRIBUTE_NOINLINE
# if _GL_GNUC_PREREQ (8, 0)
__attribute__ ((__noipa__))
# endif
-do_secret_stuff (int volatile pass, char *volatile *volatile last_stackbuf)
+do_secret_stuff (int pass, char *volatile *last_stackbuf)
{
char stackbuf[SECRET_SIZE];
if (pass == 1)
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- {
- int volatile value = (memset_explicit (NULL, '?', 0) == NULL);
- ASSERT (value);
- }
+ ASSERT (memset_explicit (NULL, '?', 0) == NULL);
return test_exit_status;
}
/* Specification. */
#include <stdlib.h>
+/* Test the library, not the compiler+library. */
+static void
+lib_qsort (void *base, size_t nel, size_t width,
+ int (*compar) (void const *, void const *))
+{
+ return qsort (base, nel, width, compar);
+}
+static void (*volatile volatile_qsort) (void *, size_t, size_t,
+ int (*) (void const *, void const *))
+ = lib_qsort;
+#undef qsort
+#define qsort volatile_qsort
+
static int
cmp (const void *a, const void *b)
{
#include "zerosize-ptr.h"
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static char *
+lib_strncat (char *s1, char const *s2, size_t n)
+{
+ return strncat (s1, s2, n);
+}
+static char *(*volatile volatile_strncat) (char *, char const *, size_t)
+ = lib_strncat;
+#undef strncat
+#define strncat volatile_strncat
+
#define UNIT char
#define U_STRNCAT strncat
#define MAGIC ((char) 0xBA)
check (input, SIZEOF (input));
}
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
#if 0 /* I think this is invalid, per ISO C 23 § 7.26.3.2. */
- value = (strncat (NULL, "x", 0) == NULL);
- ASSERT (value);
+ ASSERT (strncat (NULL, "x", 0) == NULL);
#endif
{
char y[2] = { 'x', '\0' };
- value = (strncat (y, NULL, 0) == y);
- ASSERT (value);
+ ASSERT (strncat (y, NULL, 0) == y);
}
return test_exit_status;
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static int
+lib_strncmp (char const *s1, char const *s2, size_t n)
+{
+ return strncmp (s1, s2, n);
+}
+static int (*volatile volatile_strncmp) (char const *, char const *, size_t)
+ = lib_strncmp;
+#undef strncmp
+#define strncmp volatile_strncmp
+
int
main (void)
{
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
-
- value = (strncmp (NULL, "x", 0) == 0);
- ASSERT (value);
-
- value = (strncmp ("x", NULL, 0) == 0);
- ASSERT (value);
-
- value = (strncmp (NULL, NULL, 0) == 0);
- ASSERT (value);
+ ASSERT (strncmp (NULL, "x", 0) == 0);
+ ASSERT (strncmp ("x", NULL, 0) == 0);
+ ASSERT (strncmp (NULL, NULL, 0) == 0);
return test_exit_status;
}
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static char *
+lib_strncpy (char *s1, char const *s2, size_t n)
+{
+ return strncpy (s1, s2, n);
+}
+static char *(*volatile volatile_strncpy) (char *, char const *, size_t)
+ = lib_strncpy;
+#undef strncpy
+#define strncpy volatile_strncpy
+
int
main (void)
{
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- value = (strncpy (NULL, "x", 0) == NULL);
- ASSERT (value);
+ ASSERT (strncpy (NULL, "x", 0) == NULL);
{
char y[1];
- value = (strncpy (y, NULL, 0) == y);
- ASSERT (value);
+ ASSERT (strncpy (y, NULL, 0) == y);
}
return test_exit_status;
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static char *
+lib_strndup (char const *s, size_t size)
+{
+ return strndup (s, size);
+}
+static char *(*volatile volatile_strndup) (char const *, size_t)
+ = lib_strndup;
+#undef strndup
+#define strndup volatile_strndup
+
int
main (void)
{
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
-
- value = (strndup (NULL, 0) != NULL);
- ASSERT (value);
+ ASSERT (strndup (NULL, 0) != NULL);
return test_exit_status;
}
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static wchar_t *
+lib_wcsncat (wchar_t *ws1, wchar_t const *ws2, size_t n)
+{
+ return wcsncat (ws1, ws2, n);
+}
+static wchar_t *(*volatile volatile_wcsncat) (wchar_t *, wchar_t const *,
+ size_t)
+ = lib_wcsncat;
+#undef wcsncat
+#define wcsncat volatile_wcsncat
+
int
main ()
{
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
#if 0 /* I think this is invalid, per ISO C 23 § 7.31.4.3.2. */
- value = (wcsncat (NULL, L"x", 0) == NULL);
- ASSERT (value);
+ ASSERT (wcsncat (NULL, L"x", 0) == NULL);
#endif
{
wchar_t y[2] = { L'x', 0 };
- value = (wcsncat (y, NULL, 0) == y);
- ASSERT (value);
+ ASSERT (wcsncat (y, NULL, 0) == y);
}
return test_exit_status;
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static int
+lib_wcsncmp (wchar_t const *ws1, wchar_t const *ws2, size_t n)
+{
+ return wcsncmp (ws1, ws2, n);
+}
+static int (*volatile volatile_wcsncmp) (wchar_t const *,
+ wchar_t const *, size_t)
+ = lib_wcsncmp;
+#undef wcsncmp
+#define wcsncmp volatile_wcsncmp
+
int
main (int argc, char *argv[])
{
}
}
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
-
- value = (wcsncmp (NULL, L"x", 0) == 0);
- ASSERT (value);
-
- value = (wcsncmp (L"x", NULL, 0) == 0);
- ASSERT (value);
-
- value = (wcsncmp (NULL, NULL, 0) == 0);
- ASSERT (value);
+ ASSERT (wcsncmp (NULL, L"x", 0) == 0);
+ ASSERT (wcsncmp (L"x", NULL, 0) == 0);
+ ASSERT (wcsncmp (NULL, NULL, 0) == 0);
return test_exit_status;
}
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static wchar_t *
+lib_wcsncpy (wchar_t *ws1, wchar_t const *ws2, size_t n)
+{
+ return wcsncpy (ws1, ws2, n);
+}
+static wchar_t *(*volatile volatile_wcsncpy) (wchar_t *, wchar_t const *,
+ size_t)
+ = lib_wcsncpy;
+#undef wcsncpy
+#define wcsncpy volatile_wcsncpy
+
int
main (void)
{
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- value = (wcsncpy (NULL, L"x", 0) == NULL);
- ASSERT (value);
+ ASSERT (wcsncpy (NULL, L"x", 0) == NULL);
{
wchar_t y[1];
- value = (wcsncpy (y, NULL, 0) == y);
- ASSERT (value);
+ ASSERT (wcsncpy (y, NULL, 0) == y);
}
return test_exit_status;
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static wchar_t *
+lib_wmemchr (wchar_t const *s, wchar_t wc, size_t n)
+{
+ return wmemchr (s, wc, n);
+}
+static wchar_t *(*volatile volatile_wmemchr) (wchar_t const *, wchar_t, size_t)
+ = lib_wmemchr;
+#undef wmemchr
+#define wmemchr volatile_wmemchr
+
int
main (void)
{
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- {
- int volatile value = (wmemchr (NULL, L'?', 0) == NULL);
- ASSERT (value);
- }
+ ASSERT (wmemchr (NULL, L'?', 0) == NULL);
return test_exit_status;
}
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static int
+lib_wmemcmp (wchar_t const *ws1, wchar_t const *ws2, size_t n)
+{
+ return wmemcmp (ws1, ws2, n);
+}
+int (*volatile volatile_wmemcmp) (wchar_t const *, wchar_t const *, size_t)
+ = lib_wmemcmp;
+#undef wmemcmp
+#define wmemcmp volatile_wmemcmp
+
int
main (int argc, char *argv[])
{
ASSERT (wmemcmp (input2, input1, 1) > 0);
}
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
-
- value = (wmemcmp (NULL, L"x", 0) == 0);
- ASSERT (value);
-
- value = (wmemcmp (L"x", NULL, 0) == 0);
- ASSERT (value);
-
- value = (wmemcmp (NULL, NULL, 0) == 0);
- ASSERT (value);
+ ASSERT (wmemcmp (NULL, L"x", 0) == 0);
+ ASSERT (wmemcmp (L"x", NULL, 0) == 0);
+ ASSERT (wmemcmp (NULL, NULL, 0) == 0);
return test_exit_status;
}
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static wchar_t *
+lib_wmemcpy (wchar_t *s1, wchar_t const *s2, size_t n)
+{
+ return wmemcpy (s1, s2, n);
+}
+static wchar_t *(*volatile volatile_wmemcpy) (wchar_t *, wchar_t const *,
+ size_t)
+ = lib_wmemcpy;
+#undef wmemcpy
+#define wmemcpy volatile_wmemcpy
+
int
main (void)
{
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- value = (wmemcpy (NULL, L"x", 0) == NULL);
- ASSERT (value);
+ ASSERT (wmemcpy (NULL, L"x", 0) == NULL);
{
wchar_t y[1];
- value = (wmemcpy (y, NULL, 0) == y);
- ASSERT (value);
+ ASSERT (wmemcpy (y, NULL, 0) == y);
}
return test_exit_status;
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static wchar_t *
+lib_wmemmove (wchar_t *s1, wchar_t const *s2, size_t n)
+{
+ return wmemmove (s1, s2, n);
+}
+static wchar_t *(*volatile volatile_wmemmove) (wchar_t *, wchar_t const *,
+ size_t)
+ = lib_wmemmove;
+#undef wmemmove
+#define wmemmove volatile_wmemmove
+
int
main (void)
{
- int volatile value;
-
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- value = (wmemmove (NULL, L"x", 0) == NULL);
- ASSERT (value);
+ ASSERT (wmemmove (NULL, L"x", 0) == NULL);
{
wchar_t y[1];
- value = (wmemmove (y, NULL, 0) == y);
- ASSERT (value);
+ ASSERT (wmemmove (y, NULL, 0) == y);
}
return test_exit_status;
#include "macros.h"
+/* Test the library, not the compiler+library. */
+static wchar_t *
+lib_wmemset (wchar_t *ws, wchar_t wc, size_t n)
+{
+ return wmemset (ws, wc, n);
+}
+static wchar_t *(*volatile volatile_wmemset) (wchar_t *, wchar_t, size_t)
+ = lib_wmemset;
+#undef wmemset
+#define wmemset volatile_wmemset
+
int
main (void)
{
/* Test zero-length operations on NULL pointers, allowed by
<https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3322.pdf>. */
- {
- int volatile value = (wmemset (NULL, L'?', 0) == NULL);
- ASSERT (value);
- }
+ ASSERT (wmemset (NULL, L'?', 0) == NULL);
return test_exit_status;
}