+2025-04-14 Bruno Haible <bruno@clisp.org>
+
+ regex: Fix undefined behaviour.
+ * lib/regex.h (_REGEX_NELTS): Define to empty; don't use ISO C99
+ variable-length arrays.
+
2025-04-14 Bruno Haible <bruno@clisp.org>
select tests: Work around a Cygwin bug.
/* Definitions for data structures and routines for the regular
expression library.
- Copyright (C) 1985, 1989-2024 Free Software Foundation, Inc.
+ Copyright (C) 1985, 1989-2025 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
/* Declarations for routines. */
#ifndef _REGEX_NELTS
-# if (defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__ \
- && !defined __STDC_NO_VLA__)
+/* The macro _REGEX_NELTS denotes the number of elements in a variable-length
+ array passed to a function.
+ It was meant to make use of ISO C99 variable-length arrays, but this does
+ not work: ISO C23 ยง 6.7.6.2.(5) requires the number of elements to be > 0,
+ but the NMATCH argument to regexec() is allowed to be 0. */
+# if 0
# define _REGEX_NELTS(n) n
# else
# define _REGEX_NELTS(n)