2026-07-26 Paul Eggert <eggert@cs.ucla.edu>
+ Fix strict aliasing violations in memchr etc
+ Problem and fix reported by Lasse Collin in:
+ https://lists.gnu.org/r/bug-gnulib/2026-07/msg00172.html
+ * lib/memchr.c (__memchr), lib/memchr2.c (memchr2):
+ * lib/memrchr.c (__memrchr), lib/rawmemchr.c (rawmemchr):
+ * lib/strchrnul.c (strchrnul):
+ Add _GL_ATTRIBUTE_MAY_ALIAS to the longword typedef.
+
snprintf, vsnprintf: update doc
* doc/gnulib-intro.texi (Supported Platforms):
Also mention z/OS, Fil-C. Not sure where they should be listed
performance. On 64-bit hardware, unsigned long is generally 64
bits already. Change this typedef to experiment with
performance. */
- typedef unsigned long int longword;
+ typedef unsigned long int longword _GL_ATTRIBUTE_MAY_ALIAS;
unsigned reg_char c = (unsigned char) c_in;
performance. On 64-bit hardware, unsigned long is generally 64
bits already. Change this typedef to experiment with
performance. */
- typedef unsigned long int longword;
+ typedef unsigned long int longword _GL_ATTRIBUTE_MAY_ALIAS;
unsigned char c1 = (unsigned char) c1_in;
unsigned char c2 = (unsigned char) c2_in;
performance. On 64-bit hardware, unsigned long is generally 64
bits already. Change this typedef to experiment with
performance. */
- typedef unsigned long int longword;
+ typedef unsigned long int longword _GL_ATTRIBUTE_MAY_ALIAS;
unsigned reg_char c = (unsigned char) c_in;
# else
/* You can change this typedef to experiment with performance. */
- typedef uintptr_t longword;
+ typedef uintptr_t longword _GL_ATTRIBUTE_MAY_ALIAS;
/* Verify that the longword type lacks padding bits. */
static_assert (UINTPTR_WIDTH == UCHAR_WIDTH * sizeof (uintptr_t));
performance. On 64-bit hardware, unsigned long is generally 64
bits already. Change this typedef to experiment with
performance. */
- typedef unsigned long int longword;
+ typedef unsigned long int longword _GL_ATTRIBUTE_MAY_ALIAS;
unsigned char c = (unsigned char) c_in;
if (!c)