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/29302] isfinite returns wrong result at -O1



------- Comment #25 from fxcoudert at gcc dot gnu dot org  2006-11-05 08:19 -------
This is completely a target bug, and I have made a simple C testcase. I filed
this with Apple bug reporter under id# 4820385. Adding geoffk in CC list since
he wanted a C-only testcase, and now we have one.

$ cat ppc_longdouble.c 
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

void foo_ (long double *y)
{
  long double x;
  int n;

  x = *y;
  n = isfinite(x);
  if (n == 0)
    printf ("!finite: %d %Lg\n", n, x);
  else
    printf ("finite: %d %Lg\n", n, x);
}

int main (void)
{
  long double x;
  x = 0.0;
  x = 1 / x;
  foo_ (&x);
  return 0;
}
$ gcc-4.0 -g ppc_longdouble.c -O0 && ./a.out
finite: 1 inf
$ gcc-4.0 -g ppc_longdouble.c -O1 && ./a.out
finite: 1 inf


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |geoffk at gcc dot gnu dot
                   |                            |org
          Component|libfortran                  |target
           Keywords|                            |wrong-code
      Known to fail|                            |4.0.1 4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2006-11-05 08:19:29
               date|                            |
            Summary|nan_inf_fmt.f90 segfaults on|isfinite returns wrong
                   |Darwin PPC starting with    |result at -O1
                   |Xcode 2.4                   |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29302


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