Re: longjmp clobber warnings are utterly broken in modern gcc - Mailing list pgsql-hackers

From Tom Lane
Subject Re: longjmp clobber warnings are utterly broken in modern gcc
Date
Msg-id 22998.1422231072@sss.pgh.pa.us
Whole thread Raw
In response to Re: longjmp clobber warnings are utterly broken in modern gcc  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: longjmp clobber warnings are utterly broken in modern gcc
List pgsql-hackers
Martijn van Oosterhout <kleptog@svana.org> writes:
> On Sun, Jan 25, 2015 at 02:02:47PM -0500, Tom Lane wrote:
>> This is scary as hell.  I intend to go around and manually audit
>> every single PG_TRY in the current source code, but that is obviously
>> not a long-term solution.  Anybody have an idea about how we might
>> get trustworthy mechanical detection of this type of situation?

> It's a bit of a long shot, but perhaps if you put something like:

> asm volatile("":"":"":"memory")

> at the beginning of the catch-block it might convince the compiler to
> forget any assumptions about what is in the local variables...

Meh.  Even if that worked for gcc (which as you say is uncertain),
it would help not at all for other compilers.  The POSIX requirements
for portable code are clear: we need a "volatile" marker on affected
variables.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: longjmp clobber warnings are utterly broken in modern gcc
Next
From: Amit Langote
Date:
Subject: Re: Partitioning: issues/ideas (Was: Re: On partitioning)