Re: PG_TRY()/CATCH() in a loop reports uninitialized variables - Mailing list pgsql-hackers

From Tom Lane
Subject Re: PG_TRY()/CATCH() in a loop reports uninitialized variables
Date
Msg-id 25875.1565275667@sss.pgh.pa.us
Whole thread Raw
In response to PG_TRY()/CATCH() in a loop reports uninitialized variables  (Adam Lee <ali@pivotal.io>)
List pgsql-hackers
Adam Lee <ali@pivotal.io> writes:
> That's fine actually, but if we put the PG_TRY()/CATCH() in a loop, high
> version gcc might complain.

I'd be inclined to say "so don't do that then".  Given this interpretation
(which sure looks like a bug to me, gcc maintainers' opinion or no),
you're basically going to have to mark EVERYTHING in that function
volatile.  Better to structure the code so you don't have to do that,
which would mean not putting the TRY and the loop in the same level
of function.

I've seen other weird-maybe-bug gcc behaviors in the vicinity of
setjmp calls, too, which is another factor that pushes me not to
want to assume too much about what you can do in the same function
as a TRY call.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: clean up obsolete initdb locale handling
Next
From: Tom Lane
Date:
Subject: Re: clean up obsolete initdb locale handling