Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcnc!ncsuvx!ncsugn!emigh From: emigh@ncsugn.ncsu.edu (Ted H. Emigh) Newsgroups: comp.bugs.sys5,comp.lang.c,comp.sys.att Subject: Possible Bug in fpcc Release 1.0 Message-ID: <471@ncsugn.ncsu.edu> Date: Mon, 22-Jun-87 16:19:06 EDT Article-I.D.: ncsugn.471 Posted: Mon Jun 22 16:19:06 1987 Date-Received: Tue, 23-Jun-87 05:24:36 EDT Reply-To: emigh@ncsugn.UUCP (Ted H. Emigh) Distribution: world Organization: Genetics, North Carolina State University, Raleigh, NC Lines: 64 Xref: mnetor comp.bugs.sys5:132 comp.lang.c:2601 comp.sys.att:599 I am trying to get the following segment of code to compile under fpcc Release 1.0 (12/2/85 -- as far as I can tell, the current release) on an AT&T 3B2/400 with SVR3.0. This code comes from a larger package and I have pared it down somewhat. For the comp.lang.c folks -- is this valid C code? (The person I got this from assures me that it has compiled under a variety of compilers, systems, etc.). Of course, I have sent it through lint and it "passes", and I have been able to compile it on the unix-pc (SVR1+) Version 3.5 (we don't have cc on the 3B2). The error messages I receive follow the program: ---------------------------Start of program--------------------------------- #include main () { printf("Random number is: %i\n",randbin(10,1,2)); } /* FUNCTION randbin: return a random binomial number */ /* N is the number of trials; The probability of success is p = p1/p2 */ int randbin (N, p1, p2) register int N; /* Number of trials */ int p1, p2; /* p = p1/p2 */ { double p = (double) p1 / (double) p2; int r = 0; /* number of successes */ double chk; while (N-- > 0) { chk = rand () / (double) 32767.0; if (chk < p) r++; printf("%i %g %g %i \n",N,p,chk,r); } return (r); } -------------------------------------End of program------------------------- Now for the errors: If I compile it without optimization (fpcc -o test test.c) it compiles and runs perfectly. If I compile it with optimization (fpcc -O -o test test.c) I get the following error message: Assembler: work.c aline 37 : operand type mismatch ... operand #2 of "mmovwd": "%r7" aline 39 : operand type mismatch ... operand #1 of "mfdivd3": "%r7" As far as I can tell, it is choking on double p = (double) p1 / (double) p2; Is this a bug in fpcc? Is there any way around it? I hate to use unoptimized code as this function can be called often during some calculation intensive situations. --Ted-- -- Ted H. Emigh, Systems NonAdministrator,Genetics, NCSU, Raleigh, NC uucp: mcnc!ncsuvx!ncsugn!emigh internet: emigh%ncsugn.ncsu.edu BITNET: NEMIGH@TUCC @ncsuvx.ncsu.edu:emigh@ncsugn.ncsu.edu