#1107416 gcc-14: Please build with -fno-fold-mem-offsets on m68k

Package:
src:gcc-14
Source:
src:gcc-14
Submitter:
John Paul Adrian Glaubitz
Date:
2026-06-07 08:37:01 UTC
Severity:
normal
Tags:
#1107416#5
Date:
2025-06-07 11:32:54 UTC
From:
To:
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

#1107416#10
Date:
2025-06-08 18:57:21 UTC
From:
To:
Hi,

I was not able to tune gcc-14 properly using CFLAGS to apply this workaround
when using gcc-13 as the bootstrap compiler but the attached patch worked for
me which of course can't be used in the actual package.

It should be possible to add -fno-fold-mem-offsets to DRIVER_SELF_SPECS on
m68k. However, I currently don't understand how the syntax works. I'll
ask the Gentoo people who have done this.

Adrian

#1107416#15
Date:
2025-06-09 09:19:04 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
gcc-14, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1107416@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthias Klose <doko@debian.org> (supplier of updated gcc-14 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Mon, 09 Jun 2025 10:59:15 +0200
Source: gcc-14
Architecture: source
Version: 14.3.0-2
Distribution: experimental
Urgency: medium
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Changed-By: Matthias Klose <doko@debian.org>
Closes: 1107416
Changes:
 gcc-14 (14.3.0-2) experimental; urgency=medium
 .
   * Update to git 20250609 from the gcc-14 branch.
     - Fix PR target/119834 (S390), PR middle-end/118819,
       PR rtl-optimization/117239, PR rtl-optimization/117239,
       PR tree-optimization/117358, PR target/86772 (microblaze),
       PR c++/120123, PR c++/120161, PR fortran/85750, PR fortran/98454,
       PR target/120441 (AVR).
   * Don't default to -fno-fold-mem-offsets on m68k (Adrian Glaubitz).
     Closes: #1107416.
Checksums-Sha1:
 2a41058fca19908f697081f253c04092abffc34f 42270 gcc-14_14.3.0-2.dsc
 2d5561a2970bd7fdd49211e036172e41be4da898 580152 gcc-14_14.3.0-2.debian.tar.xz
 6fecdf711ebf83911ff8c9ee57c7bb2b6818d94b 9868 gcc-14_14.3.0-2_source.buildinfo
Checksums-Sha256:
 cbc11d4676b4845a4df101bebb97764441a6e15798b8b0f495c59c7fc9c01e59 42270 gcc-14_14.3.0-2.dsc
 5dc2badaa7f469d678b3842cb698514716fa962d546271c569b8d9bcd71e3541 580152 gcc-14_14.3.0-2.debian.tar.xz
 d895689f7199a87c230b281ca2d341f51eb25f19e654221e3985841e716130fe 9868 gcc-14_14.3.0-2_source.buildinfo
Files:
 5b319ac695b2f4953e527c09f9f5c7bf 42270 devel optional gcc-14_14.3.0-2.dsc
 18f78178a8e517b835dbdc451d0b395d 580152 devel optional gcc-14_14.3.0-2.debian.tar.xz
 ab5f411364cb1480c03f32718dcd154a 9868 devel optional gcc-14_14.3.0-2_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJEBAEBCgAuFiEE1WVxuIqLuvFAv2PWvX6qYHePpvUFAmhGowsQHGRva29AZGVi
aWFuLm9yZwAKCRC9fqpgd4+m9cdXEACSqvnB/bWXQIoyPh3m2R3CO/uDsDCeYWI0
eejuAeaKXUULODDfmyy8bTNMA+903fyri0js5ii9ZSUSgT2c2IldDKtIYDSO8D+b
xPnIalbEt1djDpj28yje6ChvaRfT5sQysuaF78qn85xYlzw5rvRoXVbWDGgMEBIr
4IQ+JcswynaGbDdlFOq03aNDCwFjBwVM+VeBCof+KBUEuW5/QP1zn1j4CgF00VJU
j9KvMCN8CoiV+T1JK8JoQ4HWrHSCWDyv82k/McCs1dduk3bqUkZ3O83mNI1Y47yF
/drramOhDh7GNbvTpw1uifLoMU1wbP0GjbZhxyAQaAm9R9vggAztuq831N2np6XU
qkFmHp1pL8kw4lNWchZb2U/uJa5LRfdVfBkhBmc42PWn7WaqQ4YyS2oHo9rxu7h2
cbB9tRj8S+hFgZwoMWHR+eJqPey+4y91ZtFmfi3mnfg+0KlL2XCAR4m1lQertHxI
WL7U3KVeppl164F0L4eMEsFzMYWXyD4kx7NrYpY3ROSs8yqxEj2+Ms1DE3kDONr8
VA/ZjCziQQ3roT1e8RvlWR7jN59w+lPX/T+gj0dZYrRwZzzXD2AeuOFxCCAOYVt5
HJw4kSGFQlB5xcEr9H3sKLjBBEmLeY15diYEb3vikL1OosepXT0ixCFiArkHfNzL
SVN1A8YGlw==
=Nx8q
-----END PGP SIGNATURE-----

#1107416#22
Date:
2025-06-09 11:49:54 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
gcc-15, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1107416@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Matthias Klose <doko@debian.org> (supplier of updated gcc-15 package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Mon, 09 Jun 2025 13:27:55 +0200
Source: gcc-15
Architecture: source
Version: 15.1.0-6
Distribution: experimental
Urgency: medium
Maintainer: Debian GCC Maintainers <debian-gcc@lists.debian.org>
Changed-By: Matthias Klose <doko@debian.org>
Closes: 1107416
Changes:
 gcc-15 (15.1.0-6) experimental; urgency=medium
 .
   * Update to git 20250609 from the gcc-15 branch.
     - Fix PR tree-optimization/120357, PR tree-optimization/120341,
       PR rtl-optimization/120182, PR tree-optimization/120003,
       PR tree-optimization/119960, PR tree-optimization/116352,
       PR target/86772 (microblaze), PR c/120180, PR c++/120123, PR c/120180,
       PR c++/120413, PR c++/120363, PR c++/120414, PR fortran/99838,
       PR fortran/102599, PR fortran/114022, PR fortran/101735,
       PR fortran/101735, PR fortran/120193, PR fortran/120049,
       PR fortran/120355, PR target/120442 (AVR), PR target/120441 (AVR),
       PR libfortran/119856, PR middle-end/118694, PR middle-end/118694,
       PR libstdc++/120432, PR libstdc++/120465, PR libstdc++/120367.
   * Don't default to -ffold-mem-offsets on m68k (Adrian Glaubitz).
     Closes: #1107416.
Checksums-Sha1:
 80fb26f1fcbd855fff04cdffb68503c049b9326a 52172 gcc-15_15.1.0-6.dsc
 f4f11f23d1852e3178e579a74e70293e4d818cf2 2494416 gcc-15_15.1.0-6.debian.tar.xz
 3283fea56a9b6b25acb9dcbe3fded786619b4778 9868 gcc-15_15.1.0-6_source.buildinfo
Checksums-Sha256:
 ac91bc5656b7b5a727d65b0241e51d8645999ef84354bdba9c49e6e0b8eb9f2b 52172 gcc-15_15.1.0-6.dsc
 d0ff3f6ce46a2bc87481076faa8cbf0b7b9af8e2cf9f0ab5152231d04db521fd 2494416 gcc-15_15.1.0-6.debian.tar.xz
 40162f0cb457978b3cd870b3fb090e1b7ad8e7d7cc53372d6285a6a6ff5621c8 9868 gcc-15_15.1.0-6_source.buildinfo
Files:
 aa1a464bc2dc76d31c724943fa4e13f7 52172 devel optional gcc-15_15.1.0-6.dsc
 af213404489913e08ad2d629f0264ef1 2494416 devel optional gcc-15_15.1.0-6.debian.tar.xz
 649eea807308f358156740d5f9838552 9868 devel optional gcc-15_15.1.0-6_source.buildinfo
-----BEGIN PGP SIGNATURE-----

iQJEBAEBCgAuFiEE1WVxuIqLuvFAv2PWvX6qYHePpvUFAmhGxYsQHGRva29AZGVi
aWFuLm9yZwAKCRC9fqpgd4+m9dGpEACZKqsBDA0vaalZMlmHmZlT81eSJbgQQgXE
IB2u88g4/CPiZOhvcNr3tBo++1DBSx1arOv8jEtvbS6oZxz/y4nbe+T8nad02BnS
KgV8zOUvODa2350Yrv3/J4LLn0uRipTzf9qM0K0X0iTPKgAEpKV6dNXsyGDUQpLq
8GHrELkgxmGhMxcIoMov7+O5bObZhWbRk1TAIYy7Kc5TAhmZd7KJCl/u9Muy99AM
G+kdlNJXEKaJii67dkZ9OdVwvZuEiv8zAfUfU83IWmqmihswaVkakVNa3SEAK156
VRws1UaolHmaV89voRohKClM1GGwxHcAFP49iB+E9RD9fwc96Fubm57oLRRlpS19
Bp6jd4SUx5+1uWYcMF/e4wLhEPmj1fDvlP1vrxNLFb5L9qIId69Csd6z/KC+15ez
qk/bCBMj4W2RHe0YH7WrkbsRWoHWooswSH/ngMOUwwhgvlOo/sDbJn5Ft856f9hf
4MsUOkZHSfxm2XSr9U++K8/Umsr1qocLAWUuvKEws3WHHdvnemTE41a/CGQnaHlq
REv0jJMsiwhTWcCN7mDTovmcZvv7Y4a2jVzOpx7xei/6bj06KfPITmOv2qbfTRvD
v/d/zwDz8QUxu4XGdVOHQjTt+W42pz7aQYOw/RqV03eLe3oz112CLuSzCfyzx276
jecOY9tDRg==
=UBtg
-----END PGP SIGNATURE-----

#1107416#31
Date:
2026-05-31 21:46:21 UTC
From:
To:
Hi,

This didn't work, unfortunately [1]. However, I used Gemini to come up with the
attached patch which fixes the glibc build problem for me. Can you include it
instead?

Thanks,
Adrian

#1107416#40
Date:
2026-06-01 05:03:18 UTC
From:
To:
Hi,

For clarification, this patch should be applied on m68k only, see [1].

Adrian

#1107416#45
Date:
2026-06-07 08:32:45 UTC
From:
To:
Hi,

I'm going to test this proposed patch now [1].

Adrian