Bug in Microsoft C 5.1

Karl Heuer karl at haddock.ima.isc.com
Sat Sep 9 08:44:09 AEST 1989


In article <4199 at ohstpy.mps.ohio-state.edu> SMITHJ at ohstpy.mps.ohio-state.edu writes:
>I ran this program on a VAX/VMS using the latest version of VAX C and the
>corresct sequence of numbers was printed out so that it does appear as tho'
>you have located a bug in the MSC 5.1 compiler.

I'm sure you already know this, but I'd like to point out that "It works on a
VAX" is not a very good test of code correctness.

>I would also suggest changing the init/while constructs you use to 'for'
>loops.  While these may seem like silly suggestions you would be suprized how
>quickly bugs disappear.

It depends on what the goal is.  I assume that at this point he just wants
someone to confirm that it's a real bug (which seems to be the case) so he can
report it to the vendor.  And even if the goal is to get the original program
working, and if it happens that converting from `while' to `for' makes this
manifestation of the bug disappear, I still wouldn't trust the compiler unless
I knew *why* it makes the symptoms go away -- i.e. what constructs tickle it,
and which ones are believed to be safe.

To the original poster: with the program being this simple and still failing,
if possible you should try single-stepping it with a debugger while examining
the contents of `i' at each step.  Or get the compiler to produce a machine-
language listing, and see if you can spot the improperly generated code.

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list