On 11/13/26 02:28, LIU Hao wrote:
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;

Pushed to master branch.

Reply via email to