On 2026-03-14 4:43 p.m., Andrew Pinski wrote:
On Sat, Mar 14, 2026 at 1:03 PM Maciej W. Rozycki<[email protected]> wrote:
Also I do believe the new MAX_FIXED_MODE_SIZE setting is also the default
(cf. UNITS_PER_WORD), so ISTM the macro can simply be removed. Question
remains why it was added in the first place in its current form.
I looked into the history. It was added when 128bit long double
support was added back in 2003 (r0-47422-g8a3812735f1147).
I can't tell if o64 (or is it eabi64) was defined at the time or even
tried to be used.
Only in recent years if __int128 is defined libstdc++ starts to
support it and uses it with __builtin_clzg (which in turn uses
MAX_FIXED_MODE_SIZE).
It might be the case that Alexandre was trying to support at one point
128bit floating pointer with o32 and needed to define
MAX_FIXED_MODE_SIZE and never removed that definition when he
submitted the final patch for 128bit floating point.
Looks more like a historical accident rather than anything else.
Thank you both for your insights. I have confirmed that simply removing the
macro resolves the issue and produces the same test results. I have updated the
patch accordingly.
Changes since v1:
* Removed the MAX_FIXED_MODE_SIZE macro entirely.
Retested with the same setup as before, cross-compiling from
x86_64-pc-linux-gnu to mips64-elf. Verified the fix with the included test case
and found no regressions. As before, I would appreciate if someone could commit
this on my behalf as I do not have write access.
Thanks,
Carter Rennick
---
From 95fa60cdb9678498ee6c73ccada1d27dcc83ef51 Mon Sep 17 00:00:00 2001
From: Carter Rennick<[email protected]>
Date: Sun, 15 Mar 2026 12:56:47 +0000
Subject: [PATCH] mips: Fix ICE on mips64-elf by removing MAX_FIXED_MODE_SIZE
override [PR120144]
The definition of MAX_FIXED_MODE_SIZE did not account for MIPS supporting
TImode, which causes an internal compiler error when building libstdc++. Upon
further
investigation, this definition appears to be a historical mistake.
This patch removes the MAX_FIXED_MODE_SIZE override, which fixes the error.
PR target/120144
gcc/ChangeLog:
* config/mips/mips.h (MAX_FIXED_MODE_SIZE): Remove erroneous definition.
gcc/testsuite/ChangeLog:
* gcc.target/mips/pr120144.c: New test.
Signed-off-by: Carter Rennick<[email protected]>
---
gcc/config/mips/mips.h | 4 ----
gcc/testsuite/gcc.target/mips/pr120144.c | 8 ++++++++
2 files changed, 8 insertions(+), 4 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/mips/pr120144.c
diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index f52d0d2358c..c461d8aea3d 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -1706,10 +1706,6 @@ FP_ASM_SPEC "\
doesn't support 128-bit integers for MIPS32 currently. */
#define LONG_LONG_ACCUM_TYPE_SIZE (TARGET_64BIT ? 128 : 64)
-/* long double is not a fixed mode, but the idea is that, if we
- support long double, we also want a 128-bit integer type. */
-#define MAX_FIXED_MODE_SIZE MIPS_LONG_DOUBLE_TYPE_SIZE
-
/* Width in bits of a pointer. */
#ifndef POINTER_SIZE
#define POINTER_SIZE ((TARGET_LONG64 && TARGET_64BIT) ? 64 : 32)
diff --git a/gcc/testsuite/gcc.target/mips/pr120144.c
b/gcc/testsuite/gcc.target/mips/pr120144.c
new file mode 100644
index 00000000000..e254771ea78
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/pr120144.c
@@ -0,0 +1,8 @@
+/* PR target/120144 */
+/* { dg-do compile } */
+/* { dg-require-effective-target int128 } */
+
+int f(unsigned __int128 t)
+{
+ return __builtin_clzg(t);
+}
--
2.53.0