[comp.sys.mips] Another C compiler bug

mcfong@mercury.sybase.com (11/01/90)

When the following program is run:

	main()
	{
		printf("7e-7 = %f\n", 7e-7);
	}

I get the following results on the following MIPS-based systems:

	RISC ULTRIX 3.0			7e-7 = 0.000000
	SGI IRIX 3.2			7e-7 = 0.000000
	MIPS OS 1.0			7e-7 = 0.000001

Looks like yet another compiler bug which MIPS has fixed but DEC and
SGI have not yet picked up.

Would someone please run the same program on the latest version of RISC
ULTRIX (4.0) and SGI IRIX (3.3) and see if DEC or SGI have fixed the
problem in their later releases?

Thanks.



Martin C. Fong
Sybase Inc.
6475 Christie Ave.
Emeryville, CA  94607
(415)596-3822
sun!sybase!mcfong
mcfong@sybase.com
decwrl::"@tis.llnl.gov:mcfong@sybase.com"

langley@ds1.scri.fsu.edu (Randolph Langley) (11/01/90)

Martin Fong writes:
>I get the following results on the following MIPS-based systems:
>
>	RISC ULTRIX 3.0			7e-7 = 0.000000
>	SGI IRIX 3.2			7e-7 = 0.000000
>	MIPS OS 1.0			7e-7 = 0.000001
>
>Looks like yet another compiler bug which MIPS has fixed but DEC and
>SGI have not yet picked up.
>
>Would someone please run the same program on the latest version of RISC
>ULTRIX (4.0) and SGI IRIX (3.3) and see if DEC or SGI have fixed the
>problem in their later releases?


I just checked IRIX 3.3.1, and the almost most recent patch[*] for ULTRIX
4.0 and they both yield the same thing as previously.

rdl


[*] I got ANOTHER one yesterday from DEC - wish they would release 
when the code was little more steady, instead of these unending patches.
I refuse to yield to the temptation of making a smart remark about
users providing what little QC that DEC seems to be doing.

brian@cimage.com (Brian Kelley) (11/01/90)

In article <11565@sybase.sybase.com> mcfong@mercury.sybase.com () writes:
>I get the following results on the following MIPS-based systems:
>
>	RISC ULTRIX 3.0			7e-7 = 0.000000
>	SGI IRIX 3.2			7e-7 = 0.000000
>	MIPS OS 1.0			7e-7 = 0.000001
>
>Looks like yet another compiler bug which MIPS has fixed but DEC and
>SGI have not yet picked up.
>
>Would someone please run the same program on the latest version of RISC
>ULTRIX (4.0) and SGI IRIX (3.3) and see if DEC or SGI have fixed the
>problem in their later releases?

I just ran it under 4.0, and sure enough:

	RISC ULTRIX 4.0			7e-7 = 0.000000

I think the main problem is ULTRIX 4.0 is using version 2.00 of the MIPS
C compiler.  Version 2.10 probably fixes this bug (I know it fixes several
others).  We are in the process of trying to get 2.10 from DEC.  It isn't
clear which version 4.1 will ship with.


---
brian@cimage.com

meggers@mothra.nts.uci.edu (Mark Eggers) (11/02/90)

No change in Ultrix 4.0 for the generic cc compiler.

/mde/

steven@uicadd.csl.uiuc.edu (Steven Parkes) (11/02/90)

In article <1990Nov1.153433.4006@cimage.com>, brian@cimage.com
	(Brian Kelley) writes:

|> I just ran it under 4.0, and sure enough:

|> 	RISC ULTRIX 4.0			7e-7 = 0.000000

|> I think the main problem is ULTRIX 4.0 is using version 2.00 of the MIPS
|> C compiler.  Version 2.10 probably fixes this bug (I know it fixes several
|> others).  We are in the process of trying to get 2.10 from DEC.  It isn't
|> clear which version 4.1 will ship with.

cc2.1 comes with the f77 layered product ... and it gives the same result as
cc2.0.

steven parkes ---------------------------------------
University of Illinois Coordinated Science Laboratory
steven@pacific.csl.uiuc.edu -------------------------

meissner@osf.org (Michael Meissner) (11/02/90)

In article <11565@sybase.sybase.com> mcfong@mercury.sybase.com writes:

| When the following program is run:
| 
| 	main()
| 	{
| 		printf("7e-7 = %f\n", 7e-7);
| 	}
| 
| I get the following results on the following MIPS-based systems:
| 
| 	RISC ULTRIX 3.0			7e-7 = 0.000000
| 	SGI IRIX 3.2			7e-7 = 0.000000
| 	MIPS OS 1.0			7e-7 = 0.000001
| 
| Looks like yet another compiler bug which MIPS has fixed but DEC and
| SGI have not yet picked up.
| 
| Would someone please run the same program on the latest version of RISC
| ULTRIX (4.0) and SGI IRIX (3.3) and see if DEC or SGI have fixed the
| problem in their later releases?

I did some checking (doesn't anybody look at the machine code these
days), and it's not a compiler bug, but a library bug.  You can
demonstrate it by changing the program to:

	main()
	{
		printf ("7e-7 = %g\n", 7e-7);
	}

and it will print "7e-7 = 7e-07" on my Ultrix 3.1 system.  On OSF/1,
it prints the correct answer.  I used by the standard C compiler (on
Ultrix) and GCC (on Ultrix and OSF/1), and they give identical
results.  I suspect the bug is that the library does not round %f
entries, but truncates them instead.

--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142

Do apple growers tell their kids money doesn't grow on bushes?