This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/31394] cos() returns wrong value unless -O0 is used
- From: "dominiq at lps dot ens dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Mar 2007 20:56:33 -0000
- Subject: [Bug target/31394] cos() returns wrong value unless -O0 is used
- References: <bug-31394-14147@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from dominiq at lps dot ens dot fr 2007-03-30 21:56 -------
> I suppose that makes it a duplicate of PR30980.
It would have been better to check it directly before updating. PR30980 was
related to g++ and gfortran and not gcc, so it seems that your platform
(i386-pc-solaris2.10?) differs from Darwin at least.
Now, could you please time the C test of PR31249, with and without -O and
report what you get:
#include <math.h>
#include <stdio.h>
int main()
{
long n = 1000000;
long i;
double mo = -1.0;
double pi = acos(mo);
double sc = 0.0;
double ss = 0.0;
double t = 0.0;
double dt = pi/n;
printf("%.17g \n", pi);
printf("%.17g \n", dt);
for (i=0; i< 40*n; i++) {
sc += cos(t);
ss += sin(t);
t += dt;
}
printf("%.17g %.17g \n", sc, ss);
}
It will take less than a couple of minutes and see if -O is a real optimization
or not on your platform.
TIA
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31394