Source: gcc-14
Version: 14.2.0-19
Severity: normal
Tags: patch
User: debian-...@lists.debian.org
Usertags: m68k
X-Debbugs-Cc: debian-...@lists.debian.org

Hello,

the new RTL optimization introduced in [1] breaks the gcc-14 build on m68k.

As discovered by the Gentoo m68k maintainers, building gcc-14 with the option
-fno-fold-mem-offsets to disable this new optimization fixes this problem.

The option does not seem to be needed on gcc-15 which builds fine in 
experimental [2].

I have used the following patch against the gcc-14 package to pass the option
during build which works for me:

--- debian/rules2.orig   2025-02-19 16:04:38.000000000 +0100
+++ debian/rules2        2025-06-06 11:55:20.606692824 +0200
@@ -227,6 +227,17 @@
   endif
 endif
 
+ifeq ($(DEB_TARGET_ARCH),m68k)
+  CFLAGS               += -fno-fold-mem-offsets
+  CXXFLAGS             += -fno-fold-mem-offsets
+  CFLAGS_FOR_BUILD     += -fno-fold-mem-offsets
+  CXXFLAGS_FOR_BUILD   += -fno-fold-mem-offsets
+  CFLAGS_FOR_TARGET    += -fno-fold-mem-offsets
+  CXXFLAGS_FOR_TARGET  += -fno-fold-mem-offsets
+  BOOT_CFLAGS          += -fno-fold-mem-offsets
+  STAGE1_CFLAGS        += -fno-fold-mem-offsets
+endif
+
 ifneq (,$(findstring -fno-omit-frame-pointer,$(shell 
DEB_HOST_ARCH=$(DEB_TARGET_ARCH) dpkg-buildflags --get CFLAGS)))
   CFLAGS_FRAME_POINTER = -fno-omit-frame-pointer
 else

The gcc maintainer will certainly know better whether all of these are
needed to fix the build and consequently avoid other packages from being
miscompiled or failing to build.

Thanks,
Adrian

> [1] 
> https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=04c9cf5c786b94fbe3f6f21f06cae73a7575ff7a
> [2] https://buildd.debian.org/status/package.php?p=gcc-15&suite=experimental

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
--- debian/rules2.orig   2025-02-19 16:04:38.000000000 +0100
+++ debian/rules2        2025-06-06 11:55:20.606692824 +0200
@@ -227,6 +227,17 @@
   endif
 endif

+ifeq ($(DEB_TARGET_ARCH),m68k)
+  CFLAGS               += -fno-fold-mem-offsets
+  CXXFLAGS             += -fno-fold-mem-offsets
+  CFLAGS_FOR_BUILD     += -fno-fold-mem-offsets
+  CXXFLAGS_FOR_BUILD   += -fno-fold-mem-offsets
+  CFLAGS_FOR_TARGET    += -fno-fold-mem-offsets
+  CXXFLAGS_FOR_TARGET  += -fno-fold-mem-offsets
+  BOOT_CFLAGS          += -fno-fold-mem-offsets
+  STAGE1_CFLAGS        += -fno-fold-mem-offsets
+endif
+
 ifneq (,$(findstring -fno-omit-frame-pointer,$(shell 
DEB_HOST_ARCH=$(DEB_TARGET_ARCH) dpkg-buildflags --get CFLAGS)))
   CFLAGS_FRAME_POINTER = -fno-omit-frame-pointer
 else

Reply via email to