Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site digi-g.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!ihnp4!stolaf!umn-cs!digi-g!mark From: mark@digi-g.UUCP (Mark Mendel) Newsgroups: net.bugs,net.sources Subject: bug in some 68000 C-compilers Message-ID: <228@digi-g.UUCP> Date: Tue, 11-Sep-84 11:57:33 EDT Article-I.D.: digi-g.228 Posted: Tue Sep 11 11:57:33 1984 Date-Received: Fri, 14-Sep-84 20:52:56 EDT Organization: DigiGraphic Systems Corp., Mpls. MN Lines: 37 I have discovered a bug in our C compiler (Pixel Computer Inc., Version 1.2, 3/9/84). Since this bug caused a core dump in the net.sources game PHANTASIA and many people have been CLUTTERING that group with complaints about a core dump, I am guessing that this bug is more wide spread. I believe our compiler is of Unisoft derivation. Attached is a short program to determine if you suffer from the bug. The bug is: fcmp(), the compiler's floating point comparison routine, destroys regiser d0. This is only a problem if a floating comparison is used as PART of an expression: previously computed sub-expressions are trashed. [in PHANTASIA, the routine printloc() uses such an expression as an array subscipt, which caused a core dump]. The fix (if you can't fix the compiler): given an expressions like: ...+(x>1.0)+... where x is a floating point variable, replace it with: tmpint = (x>1.0); ...+ tmpint + ... ===================== cut here ===================== #include main() { double x = 1.0, y = 1.0; int i; i = (x > 0) + 2*(y>0); printf ("%d\n", i); if (i != 3) printf("your compiler has problems.\n"); }