Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!decvax!tektronix!uw-beaver!ubc-vision!alberta!calgary!west From: west@calgary.UUCP Newsgroups: comp.sys.amiga Subject: Lattice 3.10 printf/scanf format string bug? Message-ID: <812@vaxb.calgary.UUCP> Date: Sun, 22-Feb-87 20:07:07 EST Article-I.D.: vaxb.812 Posted: Sun Feb 22 20:07:07 1987 Date-Received: Thu, 26-Feb-87 22:54:31 EST Organization: U. of Calgary, Calgary, Ab. Lines: 73 My brother wrote a very simple program which is bug free, as far as I can tell. It does weird things, like not reading floating point input, and actually printing %lf to the screen. This is not possible without double %%'s. (Unless there is a bug in Lattice). The scanf statement returns 0 too, so it is fried as well! code: #include #include union stuffing { double db; char c[8]; }; main() { union stuffing t; unsigned char test[80]; int i,again = 1; while(again){ t.db = 0.0; printf("input decimal number "); scanf("%lf",&(t.db)); /* the contents of t is unchanged! */ printf("\n"); printf("%d,%lf\n",0,t.db); /* output of this line tends to be: 0,%lf */ printf("\n"); printf("bytes"); for (i =0;i<=7;i++){ printf("%o ",t.c[i]); } printf("\n"); for (i =0;i<=7;i++){ printf("%u ",t.c[i]); } printf("\n"); printf("again(y/n)?"); scanf("%s",test); if (test[0] == 'n') again = 0; } } We applied amfix001 and amfix002 to lc.lib, lcmffp.lib and lc2. These fixes keep the system from crashing now, but this weird %lf bug still persists. Is this a known bug? Is something else wrong that we can fix, or should Lattice be informed? Hints and suggestions welcomed (intelligent hints only, please :-) ) Darrin West. -- Darrin West, Master's Unit (read: student). ..![ubc-vision,ihnp4]! Department of Computer Science alberta!calgary!west University of Calgary. Can you say '88 Winter Games? Brain fault (cortex dumped)