Re: longjmp clobber warnings are utterly broken in modern gcc

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: longjmp clobber warnings are utterly broken in modern gcc
Date: 2015-01-26 16:30:59
Message-ID: 20150126163059.GE9916@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-01-26 11:18:41 -0500, Tom Lane wrote:
> Also and perhaps more to the point, I'm no longer convinced that this sort
> of thing doesn't require any volatile markers. The fundamental problem
> we're hitting with PG_TRY is that the compiler is optimizing on the
> assumption that no "unexpected" touches/changes of local variables can
> happen as a result of unexpected control flow. I think it might still be
> willing to optimize away superficially-dead stores even if you structure
> stuff as above. We need to take a closer look at the uses of
> PG_ENSURE_ERROR_CLEANUP as well ...

Robert's premise was that the new notion doesn't allow catching an
error. If the state that's passed isn't endangered (because it's marked
volatile :(), then there's no danger with the bit after the CATCH
block. That's obviously not the case for ENSURE_ERROR_CLEANUP. That
definitely needs volatiles for stuff that's referenced after the TRY
block if modified inside.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2015-01-26 16:43:01 Abbreviated keys for Numeric (was: Re: B-Tree support function number 3 (strxfrm() optimization))
Previous Message Tom Lane 2015-01-26 16:18:41 Re: longjmp clobber warnings are utterly broken in modern gcc