Re: [HACKERS] Is this code safe?

2014-08-28 Thread Pavan Deolasee
On Thu, Aug 28, 2014 at 11:20 AM, Tom Lane wrote: > Pavan Deolasee 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. T

Re: [HACKERS] Is this code safe?

2014-08-27 Thread Tom Lane
Pavan Deolasee 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. Not that that's always stopped compiler writers; but I think yo

[HACKERS] Is this code safe?

2014-08-27 Thread Pavan Deolasee
Someone reported an issue on XL mailing list about the following code in fe-connect.c failing on Power PC platform: 1844 if (getsockopt(conn->sock, SOL_SOCKET, SO_ERROR, 1845(char *) &optval, &optlen) == -1) 1846 { 1847