[comp.sys.amiga.tech] Bug in Lattice 5.02?

pawn@wpi.wpi.edu (Kevin Goroway) (05/06/90)

Can anyone tell me what is wrong with the code that follows?
It compiles fine on my 2500/20, but crashes for some reason...
/*begin program */
#include <stdio.h>
#include <math.h>
#include <m68881.h>
 
main()
{
FILE *fp;
float tmp1;
 
fp=fopen("prog4.dat","r");
if(fp == 0) {
  printf("couldn't open file\n");
  exit(1);
  }
 
fscanf(fp,"%f",&tmp1);          /*this works just fine... */
printf("it was %f\n",tmp1);
 
fscanf(fp,"%f",&tmp1);          /* this crashes the machine... */
printf("it was %f\n",tmp1);
}
/* end program...*/

The data file simply looks like this...
2.
0. 1. 0.
etc....

It was compiled like this:
lc -m2 -f8 test
blink from lib:c.o+test.o to test lib lib:lcm881.lib+lib:amiga.lib+lib:lc.lib

I think I've done everything that I need to, to utilize the 881...
Anyone care to explain why this is crashing?

thanks...



-- 
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
| Worcester Polytechnic Institute   | "It happens sometimes, people just     |
| Pawn@wpi.wpi.edu  Pawn@wpi.bitnet |   explode, natural causes."-Repo Man   |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=