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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
index 454e5e9fc779..048fc66d7be3 100644
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -445,7 +445,7 @@ typedef struct {
      use __float128 here; that is only available on some
      architectures, but only on i386 is extra alignment needed for
      __float128.  */
-#ifdef __i386__
+#if defined(__i386__) && !defined(__MINGW32__)
   __float128 __max_align_f128 
__attribute__((__aligned__(__alignof(__float128))));
 #endif
 } max_align_t;
--
2.56.1

From 462d2d679fac2ba14da07f544fd5c80bc5928aee Mon Sep 17 00:00:00 2001
From: LIU Hao <[email protected]>
Date: Thu, 12 Nov 2026 19:48:02 +0800
Subject: [PATCH 9101/9102] 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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ginclude/stddef.h b/gcc/ginclude/stddef.h
index 454e5e9fc779..048fc66d7be3 100644
--- a/gcc/ginclude/stddef.h
+++ b/gcc/ginclude/stddef.h
@@ -445,7 +445,7 @@ typedef struct {
      use __float128 here; that is only available on some
      architectures, but only on i386 is extra alignment needed for
      __float128.  */
-#ifdef __i386__
+#if defined(__i386__) && !defined(__MINGW32__)
   __float128 __max_align_f128 
__attribute__((__aligned__(__alignof(__float128))));
 #endif
 } max_align_t;
-- 
2.56.1

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to