Newsgroups: comp.os.linux.announce
From: ig25@fg70.rz.uni-karlsruhe.de (Thomas Koenig)
Subject: Serious p2c bug with Linux
Message-ID: <1993Jul10.190915.16631@dg-rtp.dg.com>
Approved: linux-announce@tc.cornell.edu (Matt Welsh)
Date: Sat, 10 Jul 93 19:09:15 GMT

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 <p2c/p2c.h>


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
