Re: longjmp clobber warnings are utterly broken in modern gcc

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: longjmp clobber warnings are utterly broken in modern gcc
Date: 2015-01-26 00:11:12
Message-ID: 22998.1422231072@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Martijn van Oosterhout <kleptog(at)svana(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2015-01-26 01:42:57 Re: Partitioning: issues/ideas (Was: Re: On partitioning)
Previous Message Martijn van Oosterhout 2015-01-25 22:39:22 Re: longjmp clobber warnings are utterly broken in modern gcc