santosh wrote:
[...]
> > >> > Does the bug only occur with "for(;0
"? What about:
[...]
> > > The bug seems to be produced only with a numeric literal. There may be
> > > other possibilities too, but whose's going to bother testing
> > > exhaustively such an outdated compiler/s.
> >
> > I'll bet it's an optimization gone awry. The author(s) probably tried
> > to optimize the case of a constant condition and got the logic
> > backwards.
> >
> > I wonder whether "for (;1
" also misbehaves.
>
> Nope. It results in an infinite loop as it should. Thus far it only
> seems to occur for literal constant 0. I'm rather surprised though that
> nobody seems to have spotted it in about 15 years.
Well, the bug was fixed in a later release, either intentionally (because
someone found it) or unintentionally (in which case it was no longer there
to be "spotted").
In either case, how often does one write "for(;0

"? (BTW, does "while(0)"
fail the same way?)
--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody |
www.hvcomputer.com | |
| kenbrody/at\spamcop.net |
www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <private.php?do=newpm&u=>