Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!tut.cis.ohio-state.edu!tinman.cis.ohio-state.edu!bob From: bob@tinman.cis.ohio-state.edu (Bob Sutterfield) Newsgroups: gnu.gcc.bug Subject: gcc 1.35 float, double bugs on Sun3, Pyramid Message-ID: Date: 27 Jun 89 15:26:57 GMT Sender: news@tut.cis.ohio-state.edu Reply-To: Bob Sutterfield Distribution: gnu Organization: The Ohio State University Dept of Computer & Information Science Lines: 97 Based on the following thumbnail tests, I'm recommending that our Sun-3 users invoke gcc with "-O -ffloat-store" and our Pyramid users avoid "-O". /* This is a test for floating point arithmetic by Douglas Yarrington (yarringt@cis.ohio-state.edu) */ #include main() { double test; float test1; test = 3.1415; printf("%4.3e\n",3.1415 ); printf("%f\n", test ); test1 = 3.1415; printf("%f\n", test1 ); } compiler machine switches results -------- ------- -------- ------- Sun CC Sun3/OS3.5.1 yes -O yes -g yes GNU CC 1.35 Sun3/OS3.5.1 no (a) -g no (b) -O const & double OK, float bad -O -g const & double OK, float bad -ffloat-store no -ff-s -g no (c) -ff-s -O yes -ff-s -O -g yes GNU CC 1.26 NeXT/Mach0.9 yes -O yes -g yes -O -g yes -ffloat-store yes -ff-s -g yes -ff-s -O yes -ff-s -O -g yes Sun CC Sun4/OS4.0.1 yes -O yes -g yes GNU CC 1.35 Sun4/OS4.0.1 yes -O yes -g yes -O -g yes -ffloat-store yes -ff-s -O yes -ff-s -O -g yes -ff-s -g yes Pyramid CC Pyramid/OSx4.0 yes -O yes -OG yes -g yes GNU CC 1.35 Pyramid/OSx4.0 yes -g yes (d) -O double OK, const & float diff -O -g double OK, const & float diff -ffloat-store yes -ff-s -g yes -ff-s -O double OK, const & float diff -ff-s -O -g double OK, const & float diff sample output: (a) (sun3, gcc -g) 11:02am> ./test-gccg 0.000e+00 0.000000 0.000000 11:02am> (b) (sun3, gcc -O) 11:03am> ./test-gccO 3.142e+00 3.141500 0.000000 11:03am> (c) (sun3, gcc -O -gfloat-store) (this is the correct output) 11:03am> ./test-gccOf 3.142e+00 3.141500 3.141500 11:03am> (d) (pyramid, gcc -O) 11:04am> ./test-gccPO 3.141e+00 3.141500 2.142687 11:04am>