https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103635
Bug ID: 103635 Summary: size_t and uintptr_t have wrong sizes with x86_64-w64-mingw32-g++ -mabi=sysv Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mark at harmstone dot com Target Milestone: --- When you add the option -mabi=sysv to mingw for amd64, it changes size_t and uintptr_t from 64 to 32 bits. Minimal example: tmp.cpp: #include <stddef.h> static_assert(sizeof(size_t) == 8, "!"); static_assert(sizeof(uintptr_t) == 8, "!"); Working: x86_64-pc-linux-gnu-g++ -mabi=ms -c tmp.cpp x86_64-pc-linux-gnu-g++ -mabi=sysv -c tmp.cpp x86_64-pc-cygwin-g++ -mabi=ms -c tmp.cpp x86_64-pc-cygwin-g++ -mabi=sysv -c tmp.cpp x86_64-w64-mingw32-g++ -mabi=ms -c tmp.cpp Not working: x86_64-w64-mingw32-g++ -mabi=sysv -c tmp.cpp tmp.cpp:2:30: error: static assertion failed: ! 2 | static_assert(sizeof(size_t) == 8, "!"); | ~~~~~~~~~~~~~~~^~~~ tmp.cpp:3:33: error: static assertion failed: ! 3 | static_assert(sizeof(uintptr_t) == 8, "!"); | My hunch is that perhaps GCC is assuming that long is the same size as a pointer, which it's not on Windows. The SysV specs say that size_t is equivalent to unsigned long on LP64 (but unsurprisingly doesn't mention the LLP64 that Windows uses). The practical problem this causes is that you can't #include <string> on mingw with -mabi=sysv, as _mm_malloc amongst others uses size_t to do pointer arithmetic.