Bug in Microsoft C 5.1

M E Fletcher mapmef at gdr.bath.ac.uk
Thu Sep 7 20:43:22 AEST 1989


I've trimmed my program down substantially so there's for excuse at not
looking at it now! I already know it's weird and horrible, but that's
because it's from a larger program which has undergone major surgery.


#include <stdio.h>
static unsigned modulo[9]={0,0,0,0,0,0,0,0,0};
main()
{long *timeptr;
 int i;
 unsigned status;
 i=0; while (i!=9)
 {do {status=do_nothing(0,0,0);
      printf("%d\n",i); }
     while (0);
  do {status=do_nothing(0,0,modulo[i]);}
     while (status);
  i++;
 }
}
int do_nothing(a,b,c)
int a,b,c;
{return(0);}

 When I run this instead of printing out 0,1,2,3,4,5 etc. It prints out
0,1,1,1,1,1 etc. I think there is a bug in the compiler I am using :
Micorsoft's 5.1 .  Can anyone confirm/deny/reproduce this?

Matthew Fletcher, University of Bath, England



More information about the Comp.lang.c mailing list