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 fortran/14394] New: [gfortran] Intrinsic TAN function returns incorrect value


This test distilled from the NIST F77 compiler validation suite, test FM374:

$ cat z.f
        REAL AVS,BVS
        BVS = 1.5747025767
        AVS = TAN(BVS)
        PRINT*,AVS
        END
$ /usr/local/bin/gfortran -static -g z.f
$ ./a.out
  -255.9724

The expected value is -256 +- 0.02  (according to the test)

g77 meets this requirement:

$ g77 z.f
$ ./a.out
 -255.995834

Looking at the output of -fdump-tree-all

$ cat z.f.t03.original
MAIN__ ()
{
  real4 bvs;
  real4 avs;
 
  bvs = 1.5747029781341552734375e+0;
  avs = __builtin_tanf (bvs);
  _gfortran_filename = "z.f";
  _gfortran_line = 4;
  _gfortran_ioparm.unit = 6;
  _gfortran_ioparm.list_format = 1;
  _gfortran_st_write ();
  _gfortran_transfer_real (&avs, 4);
  _gfortran_st_write_done ();;
}

The difference in the two constants explains the difference, so it appears to be
a problem in the fortran front end instead of tan().

-- 
           Summary: [gfortran]  Intrinsic TAN function returns incorrect
                    value
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bdavis9659 at comcast dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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