On 2025-04-15 10:01, Christian Hesse wrote:
The build succeed as soon as I disable link time optimization. Would be nice
to have a fix for this to reenable lto.
Thanks for reporting that. It's a false alarm from GCC. I worked around
the problem by installing the attached patch into Gnulib to pacify GCC,
and I'm closing the grep bug report.From 60d9b4134f8661dc25134dbe54be15f6138718c8 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Tue, 15 Apr 2025 13:50:32 -0700
Subject: [PATCH] dfa: pacify gcc -Wstringop-overflow
Problem reported by Christian Hesse in:
https://bugs.gnu.org/77828
* lib/dfa.c (dfaanalyze): Pacify gcc -flto -Wstringop-overflow.
---
ChangeLog | 7 +++++++
lib/dfa.c | 1 +
2 files changed, 8 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 7d255be3a2..28322a2655 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-04-15 Paul Eggert <egg...@cs.ucla.edu>
+
+ dfa: pacify gcc -Wstringop-overflow
+ Problem reported by Christian Hesse in:
+ https://bugs.gnu.org/77828
+ * lib/dfa.c (dfaanalyze): Pacify gcc -flto -Wstringop-overflow.
+
2025-04-15 Bruno Haible <br...@clisp.org>
gnulib-tool.py: Fix exception during --update with changed macro-prefix.
diff --git a/lib/dfa.c b/lib/dfa.c
index 684043dd8f..cbacdc04cf 100644
--- a/lib/dfa.c
+++ b/lib/dfa.c
@@ -2699,6 +2699,7 @@ dfaanalyze (struct dfa *d, bool searchflag)
addtok (d, CAT);
idx_t tindex = d->tindex;
+ assume (0 < tindex);
#ifdef DEBUG
fprintf (stderr, "dfaanalyze:\n");
--
2.48.1