Usenet comp.os.linux.announce (1993-2013)
 help / color / mirror / Atom feed
From: ig25@fg70.rz.uni-karlsruhe.de (Thomas Koenig)
Subject: Serious p2c bug with Linux
Date: Sat, 10 Jul 93 19:09:15 GMT	[thread overview]
Message-ID: <1993Jul10.190915.16631@dg-rtp.dg.com> (raw)

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


                 reply	other threads:[~1993-07-10 19:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox