Don't use __builtin_setjmp on aarch64 MinGW/Windows - #48
Open
gburd wants to merge 1 commit into
Open
Conversation
Commit 146cb38 made the WIN32/MinGW-64 build use gcc's __builtin_setjmp/__builtin_longjmp to work around longstanding issues in MinGW-64's own setjmp support. That workaround is fine on x86_64 MinGW, but it is broken on aarch64 (ARM64) MinGW toolchains: * clang for aarch64-w64-windows-gnu does not implement __builtin_setjmp at all -- it errors with "__builtin_setjmp is not supported for the current target"; and * where the builtin is accepted its first argument is a void **, which is incompatible with the intptr_t sigjmp_buf[5] that c.h declares, producing "incompatible pointer types passing 'sigjmp_buf' to parameter of type 'void **'". The net effect is that a PostgreSQL build with a clang-based aarch64 MinGW toolchain fails to compile as early as src/common/pg_get_line.c (the first caller of sigsetjmp()). Restrict the __builtin_setjmp path to !defined(__aarch64__) so that aarch64 MinGW falls back to plain setjmp()/longjmp(), the same path already used for non-MinGW Windows toolchains. x86_64 MinGW is unchanged. Reported while building for aarch64 Windows with an MSYS2 clangarm64 toolchain.
|
📜 Change history & discussion (Agora / pg.ddx.io)I have the key facts. The upstream commit exists (announced by Andrew Dunstan). Note the dates in the index appear rewritten (2026), but the real thread dates are 2025-02 through 2025-04. This PR replicates a change already committed to PostgreSQL upstream. 🧵 Related discussion
🔗 Related commits / prior art
📋 Commitfest
🧭 Context for reviewers
Generated by pg-history via the Agora MCP server (pg.ddx.io). |
gburd
force-pushed
the
master
branch
6 times, most recently
from
July 29, 2026 12:03
576fa38 to
70ceeea
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the compile failure at src/common/pg_get_line.c on aarch64 MinGW toolchains (clang aarch64-w64-windows-gnu), where
__builtin_setjmpis not implemented and its prototype (void **) is incompatible with theintptr_t sigjmp_buf[5]declared by c.h.Restricts the 146cb38 builtin-setjmp workaround to
!defined(__aarch64__)so aarch64 MinGW falls back to plain setjmp()/longjmp(). x86_64 MinGW unchanged (the underlying MinGW-64 setjmp bug persists there — see c313fa4 and its revert 8f5e419).Runtime-verified on aarch64 Windows 11 (MSYS2 clangarm64, clang 22.1.8): full build (2103/2103), initdb OK, 25/25 elog(ERROR)→siglongjmp recovery cycles, nested PL/pgSQL exception blocks, no TRAP/PANIC/crash.
Intended for pgsql-hackers submission; PR opened to run CI.