Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)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. Not that that's
always stopped compiler writers; but I think you might be looking at a
compiler bug. We'd need more context about the exact platform, compiler,
etc.
regards, tom lane