https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101912

--- Comment #4 from eggert at cs dot ucla.edu ---
(In reply to Aldy Hernandez from comment #3)
> >               && !(leapcnt == 0
> >                    || (prevcorr < corr
> >                        ? corr == prevcorr + 1
> >                        : (corr == prevcorr
> >                           || corr == prevcorr - 1)))))
> > 
> 
> I guess the question is whether language rules allow us to read prevcorr
> when leapcnt== 0?

The C language rules do not allow that. When leapcnt is zero, behavior must be
as if the prevcorr expression is not evaluated.

Although the compiler can generate machine code that evaluates prevcorr at the
machine level (so long as the observable behavior is the same, which is the
case as prevcorr is not volatile and no untoward behavior can result from
evaluating the prevcorr expression), it's incorrect if the compiler warns the
programmer that prevcorr is used uninitialized.

Reply via email to