Re: Is this code safe? - Mailing list pgsql-hackers

From Pavan Deolasee
Subject Re: Is this code safe?
Date
Msg-id CABOikdO4ZaE-T_x-DDuFCTb1fN1LVX_C3=d_Hxtm0dT9XBNhOg@mail.gmail.com
Whole thread Raw
In response to Re: Is this code safe?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

On Thu, Aug 28, 2014 at 11:20 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Pavan Deolasee <pavan.deolasee@gmail.com> writes:
> Can some kind of compiler optimisation reorder things such that the "else
> if" expression is evaluated using the old, uninitialised value of optval?

Any such behavior is patently illegal per the C standard.

Thanks a lot for explaining that. 
 
  Not that that's
always stopped compiler writers; but I think you might be looking at a
compiler bug.

I'd requested the reporter to try moving the getsockopt() call outside "if" expression. That hasn't helped. So I think its a case of getsockopt() neither returning an error nor setting optval to any sane value. Will try to get more details about the platform etc.
 
Thanks,

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: [Fwd: Re: proposal: new long psql parameter --on-error-stop]
Next
From: Magnus Hagander
Date:
Subject: Re: re-reading SSL certificates during server reload