When using the Microsoft C runtime on 32-bit x86 systems, the alignment should be 8. Their `malloc()` returns pointers that are only aligned to 8 bytes, and their C++-only `max_align_t` is a typedef for `double`.
So exclude `__float128` there, which also matches mingw-w64 headers.
gcc/ChangeLog:
* ginclude/stddef.h: Exclude `__float128` from `max_align_t` for MinGW
targets.
Signed-off-by: LIU Hao <[email protected]>
---
gcc/ginclude/stddef.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
index 454e5e9fc779..1a063d32ad24 100644
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -444,8 +444,9 @@ typedef struct {
sufficiently aligned for it. This code must work in C++, so we
use __float128 here; that is only available on some
architectures, but only on i386 is extra alignment needed for
- __float128. */
-#ifdef __i386__
+ __float128. When using the 32-bit Microsoft runtime, the
+ alignment should be 8, to keep binary compatibility. */
+#if defined(__i386__) && !defined(__MINGW32__)
__float128 __max_align_f128
__attribute__((__aligned__(__alignof(__float128))));
#endif
} max_align_t;
--
2.56.1
From 5359c235181d9fa57cbbb92909cba743e00e1318 Mon Sep 17 00:00:00 2001 From: LIU Hao <[email protected]> Date: Thu, 12 Nov 2026 19:48:02 +0800 Subject: [PATCH] ginclude: Exclude `__float128` from `max_align_t` for MinGW targets When using the Microsoft C runtime on 32-bit x86 systems, the alignment should be 8. Their `malloc()` returns pointers that are only aligned to 8 bytes, and their C++-only `max_align_t` is a typedef for `double`. So exclude `__float128` there, which also matches mingw-w64 headers. gcc/ChangeLog: * ginclude/stddef.h: Exclude `__float128` from `max_align_t` for MinGW targets. Signed-off-by: LIU Hao <[email protected]> --- gcc/ginclude/stddef.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h index 454e5e9fc779..1a063d32ad24 100644 --- a/gcc/ginclude/stddef.h +++ b/gcc/ginclude/stddef.h @@ -444,8 +444,9 @@ typedef struct { sufficiently aligned for it. This code must work in C++, so we use __float128 here; that is only available on some architectures, but only on i386 is extra alignment needed for - __float128. */ -#ifdef __i386__ + __float128. When using the 32-bit Microsoft runtime, the + alignment should be 8, to keep binary compatibility. */ +#if defined(__i386__) && !defined(__MINGW32__) __float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128)))); #endif } max_align_t; -- 2.56.1
OpenPGP_signature.asc
Description: OpenPGP digital signature
