[9381] in Athena Bugs
vax 7.3P: program compiled with cc giving incorrect results - really
daemon@ATHENA.MIT.EDU (sethf@Athena.MIT.EDU)
Mon Jun 1 00:22:40 1992
From: sethf@Athena.MIT.EDU
To: bugs@Athena.MIT.EDU
Date: Mon, 01 Jun 92 00:22:24 EDT
System name: tum-tum-tree
Type and version: VAXSTAR 7.3P
Display type: SM
What were you trying to do?
Well, the essence of it is contained in the following little program:
#include <stdio.h>
main() {
unsigned int i;
float a[256];
for (i=1;i<=20;i++) a[i]=(float)i;
printf("%f",a[5]);
}
What's wrong:
Using cc, this prints out 2.5 . Deleting the "unsigned" or using
gcc gives the correct result.
What should have happened:
It should have printed 5.0
Please describe any relevant documentation references:
cc(1),gcc(1)