This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/31394] cos() returns wrong value unless -O0 is used



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]