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