----- Original message -----
From: Bruno Haible <br...@clisp.org>
To: debian-common-l...@lists.debian.org, Peter van Eynde <pvane...@debian.org>, 
Christoph Egger <christ...@debian.org>
Subject: clisp needs patch to work around gcc 15 bug
Date: Sunday, April 27, 2025 01:38

Hi,

Just to let you know that when Debian will adopt gcc 15, it will miscompile
GNU clisp. Find attached a workaround. With that workaround, it builds fine.

Bruno

From a4270765e364bd3e71c0a5f841977954fcc56345 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sun, 27 Apr 2025 00:03:13 +0200
Subject: [PATCH] Work around a gcc 15.1.0 bug on x86_64.

* package.d (rehash_symtab): When compiled by GCC 15, disable all
optimizations.
---
 src/ChangeLog | 6 ++++++
 src/package.d | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/ChangeLog b/src/ChangeLog
index c68c25390..cbbb78e0b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2025-04-26  Bruno Haible  <br...@clisp.org>
+
+	Work around a gcc 15.1.0 bug on x86_64.
+	* package.d (rehash_symtab): When compiled by GCC 15, disable all
+	optimizations.
+
 2024-12-28  Bruno Haible  <br...@clisp.org>
 
 	Update after gnulib changed.
diff --git a/src/package.d b/src/package.d
index 1ce9cdfc5..e9b771dad 100644
--- a/src/package.d
+++ b/src/package.d
@@ -146,6 +146,11 @@ local maygc void newinsert (object sym, uintL size) {
   TheSvector(STACK_1)->data[index] = sym; /* enter new entry in newtable */
 }
 
+/* Work around GCC bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119959>. */
+#if __GNUC__ == 15
+#pragma GCC optimize ("-O0")
+#endif
+
 local maygc object rehash_symtab (object symtab) {
   pushSTACK(symtab); /* save symbol-table */
   var uintL oldsize = posfixnum_to_V(Symtab_size(symtab)); /* old size */
@@ -242,6 +247,10 @@ local maygc object rehash_symtab (object symtab) {
   return symtab;
 }
 
+#if __GNUC__ == 15
+#pragma GCC reset_options
+#endif
+
 /* UP: Searches a symbol of given printname in the list.
  > string: string
  > invert: whether to implicitly case-invert the string
-- 
2.43.0

Reply via email to