On 12/10/2026 06:25, Paul Eggert wrote:
Thanks for the bug report. I installed the attached, which is a bit fancier 
than what you suggested in order to handle the tricky cases that  
case_folded_counterparts handles, e.g., Greek where a single uppercase 
character (Σ) can have multiple lowercase counterparts (σ, ς, ϲ). The first 
patch fixes the bug and adds a test case; the second updates commentary.

I have the feeling that there are other bugs in this area, with respect to 
unusual Unicode characters. I'll try to find time to fix that.

GCC 16.2 is giving a false positive like:

test-regex-el.c: In function 'main':
 test-regex-el.c:83:41: warning: '%s' directive writing up to 5 bytes
                        into a region of size 4 [-Wformat-overflow=]
 83 |           int patlen = sprintf (pat, "%s%s%s", lbrack, str[i], rbrack);

The following seems to avoid the issue:

diff --git a/tests/test-regex-el.c b/tests/test-regex-el.c
index 1e2589a3b2..d16b9eb3cd 100644
--- a/tests/test-regex-el.c
+++ b/tests/test-regex-el.c
@@ -80,7 +80,7 @@ main ()
           char pat[4];
           char const *lbrack = &"["[k];
           char const *rbrack = &"]"[k];
-          int patlen = sprintf (pat, "%s%s%s", lbrack, str[i], rbrack);
+          int patlen = sprintf (pat, "%s%c%s", lbrack, str[i][0], rbrack);
           re_set_syntax (RE_ICASE);
           memset (&regex, 0, sizeof regex);
           s = re_compile_pattern (pat, patlen, &regex);

I didn't apply as I vaguely remember some talk about
-Wformat-overflow going away either in gnulib or gcc.
I've never got anything useful from it at least.

cheers,
Padraig

Reply via email to