From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4db,f0f21af925c4b169,start X-Google-Attributes: gid10d4db,public X-Google-ArrivalTime: 1993-07-10 12:57:10 PST Newsgroups: comp.os.linux.announce Path: gmd.de!Germany.EU.net!news.dfn.de!xlink.net!howland.reston.ans.net!noc.near.net!uunet!psinntp!dg-rtp!bounce-bounce From: ig25@fg70.rz.uni-karlsruhe.de (Thomas Koenig) Subject: Serious p2c bug with Linux Sender: usenet@dg-rtp.dg.com (Usenet Administration) Message-ID: <1993Jul10.190915.16631@dg-rtp.dg.com> Date: Sat, 10 Jul 93 19:09:15 GMT Reply-To: ig25@fg70.rz.uni-karlsruhe.de (Thomas Koenig) Organization: University of Karlsruhe, Germany Followup-To: comp.os.linux Keywords: Pascal, p2c, bug, multiplication There is a serious bug in the p2c that is currently distributed with SLS, which has cost a co - worker of mine a few, confusing days. In short, p2c does not do multiplications with numbers in the format 1.0E3. Converting them to the equivalent 1000. works. If you convert old PC code to Linux, beware of this. Here's a short session, which reproduces the bug. /usr/home/t-rex> cat > hello.p program hello; var a: real; begin readln(a); writeln(a*1.0E3); end. /usr/home/t-rex> p2c hello.p hello Translation completed. /usr/home/t-rex> cat hello.c /* Output from p2c, the Pascal-to-C translator */ /* From input file "hello.p" */ #include main(argc, argv) int argc; Char *argv[]; { double a; PASCAL_MAIN(argc, argv); scanf("%lg%*[^\n]", &a); getchar(); printf("% .5E\n", a); exit(EXIT_SUCCESS); } /* End. */ /usr/home/t-rex> cc hello.c -lp2c /usr/home/t-rex> a.out 10 1.00000E+01 /usr/home/t-rex> exit -- Thomas Koenig, ig25@rz.uni-karlsruhe.de, ig25@dkauni2.bitnet The joy of engineering is to find a straight line on a double logarithmic diagram. -- Send submissions for comp.os.linux.announce to: linux-announce@tc.cornell.edu