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

John Paul Adrian Glaubitz <[email protected]> Sun, 31 May 2026 23:46:21 +0200
Newsgroups gmane.linux.debian.devel.gcc
Message-ID <9b6809c8eeb6da020914a975d67d75d773b207d6.camel__8832.87719204731$1780264050$gmane$org@physik.fu-berlin.de>
Control: reopen -1

Hi,

On Sun, 2025-06-08 at 20:57 +0200, John Paul Adrian Glaubitz wrote:
> 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.

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

> [1] https://buildd.debian.org/status/fetch.php?pkg=glibc&arch=m68k&ver=2.42-16&stamp=1778118395&raw=0

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
0001-m68k-Try-to-fix-PR-target-123853.patch (text/x-patch, 738 B)
From 95df132781d1e7312d4c2e0aa3498281630b92a5 Mon Sep 17 00:00:00 2001
From: John Paul Adrian Glaubitz <[email protected]>
Date: Sun, 31 May 2026 11:57:08 +0200
Subject: [PATCH] m68k: Try to fix PR target/123853

---
 gcc/recog.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/recog.cc b/gcc/recog.cc
index 4cae276f1f7..87bab224be8 100644
--- a/gcc/recog.cc
+++ b/gcc/recog.cc
@@ -1289,6 +1289,11 @@ insn_propagation::apply_to_rvalue_1 (rtx *loc)
 	  failure_reason = "is subject to autoinc";
 	  return false;
 	}
+      if (to && reg_overlap_mentioned_p (XEXP (x, 0), to))
+	{
+	  failure_reason = "replacement overlaps with autoinc";
+	  return false;
+	}
       recurse_p = true;
       break;
 
-- 
2.54.0