Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lLDqi-0003mV-N4 for pgsql-bugs@arkaria.postgresql.org; Sat, 13 Mar 2021 23:39:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lLDqh-0006sh-KM for pgsql-bugs@arkaria.postgresql.org; Sat, 13 Mar 2021 23:39:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lLDqh-0006pz-Dk for pgsql-bugs@lists.postgresql.org; Sat, 13 Mar 2021 23:39:11 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lLDqZ-0002Zg-75 for pgsql-bugs@lists.postgresql.org; Sat, 13 Mar 2021 23:39:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 12DNcxV02735802; Sat, 13 Mar 2021 18:38:59 -0500 From: Tom Lane To: =?UTF-8?Q?Juan_Jos=C3=A9_Santamar=C3=ADa_Flecha?= cc: Regina Obe , PostgreSQL mailing lists Subject: Re: BUG #16920: Can't compile PostGIS with MingW64 against PostgreSQL 14 head In-reply-to: <2730776.1615672184@sss.pgh.pa.us> References: <16920-2332590daf58407c@postgresql.org> <2291040.1615474929@sss.pgh.pa.us> <000501d71691$c616a200$5243e600$@pcorp.us> <2294904.1615480631@sss.pgh.pa.us> <000401d716a0$1ed0fc70$5c72f550$@pcorp.us> <2309396.1615485820@sss.pgh.pa.us> <004301d71772$f3336020$d99a2060$@pcorp.us> <2551612.1615579995@sss.pgh.pa.us> <000201d71781$a0c5da20$e2518e60$@pcorp.us> <2555584.1615585679@sss.pgh.pa.us> <000201d71792$1a916800$4fb43800$@pcorp.us> <2558564.1615589850@sss.pgh.pa.us> <000e01d717c2$7533c3e0$5f9b4ba0$@pcorp.us> <2589899.1615615800@sss.pgh.pa.us> <001801d71833$3eb81890$bc2849b0$@pcorp.us> <2718080.1615661446@sss.pgh.pa.us> <002d01d7183d$dda66420$98f32c60$@pcorp.us> <2730776.1615672184@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 13 Mar 2021 16:49:44 -0500" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <2735483.1615678664.0@sss.pgh.pa.us> Date: Sat, 13 Mar 2021 18:38:59 -0500 Message-ID: <2735801.1615678739@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2735483.1615678664.1@sss.pgh.pa.us> I wrote: > Hmm, interesting. The gcc manual is quite negative about these though: > https://gcc.gnu.org/onlinedocs/gcc/Nonlocal-Gotos.html > Also it's not clear that these are compatible with 's version > of jmp_buf. After further study, I think we could fix the jmp_buf inconsistency as attached. I did some googling and found that we'd be in pretty good company if we go this way: a lot of other projects have concluded that MinGW-64's setjmp() is hopelessly buggy and adopted this same workaround. It still makes me a bit nervous though, as this is a serious ABI break for anything using setjmp/longjmp. We could not back-patch such a change, and once we ship a release using this we're stuck with it in that release branch. Regina, could you confirm whether this fixes things for you? regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="0001-MinGW-x64-setjmp-longjmp-2.patch"; charset="us-ascii" Content-ID: <2735483.1615678664.2@sss.pgh.pa.us> Content-Description: 0001-MinGW-x64-setjmp-longjmp-2.patch Content-Transfer-Encoding: quoted-printable diff --git a/src/include/c.h b/src/include/c.h index 2b45e6d6ca..ced30113b3 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -1335,14 +1335,21 @@ extern unsigned long long strtoull(const char *str= , char **endptr, int base); = /* * When there is no sigsetjmp, its functionality is provided by plain - * setjmp. Incidentally, nothing provides setjmp's functionality in - * that case. We now support the case only on Windows. + * setjmp. We now support the case only on Windows. However, it seems + * that MinGW-64 has some longstanding issues in its setjmp support, + * so on that toolchain we cheat and use gcc's builtins. */ #ifdef WIN32 +#ifdef __MINGW64__ +typedef intptr_t sigjmp_buf[5]; +#define sigsetjmp(x,y) __builtin_setjmp(x) +#define siglongjmp(x,y) __builtin_longjmp(x, 1) +#else /* !__MINGW64__ */ #define sigjmp_buf jmp_buf #define sigsetjmp(x,y) setjmp(x) #define siglongjmp longjmp -#endif +#endif /* __MINGW64__ */ +#endif /* WIN32 */ = /* EXEC_BACKEND defines */ #ifdef EXEC_BACKEND ------- =_aaaaaaaaaa0--