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