[Bug fortran/36117] New: Use MPFR for bessel function (optimization, rejects valid F2008)

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat May 3 12:31:00 GMT 2008


Currently, the Bessel function are not simplified, even though MPFR supports
this (since 2.3.0) via
— Function: int mpfr_j0 (mpfr_t rop, mpfr_t op, mp_rnd_t rnd)
— Function: int mpfr_j1 (mpfr_t rop, mpfr_t op, mp_rnd_t rnd)
— Function: int mpfr_jn (mpfr_t rop, long n, mpfr_t op, mp_rnd_t rnd)
— Function: int mpfr_y0 (mpfr_t rop, mpfr_t op, mp_rnd_t rnd)
— Function: int mpfr_y1 (mpfr_t rop, mpfr_t op, mp_rnd_t rnd)
— Function: int mpfr_yn (mpfr_t rop, long n, mpfr_t op, mp_rnd_t rnd)

(One should use: #if MPFR_VERSION >= MPFR_VERSION_NUM(2,3,0) )

------------------

Found at:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/97eec25eef27e9fb

See especially, these two posts by James Van Buskirk:
http://groups.google.com/group/comp.lang.fortran/msg/44e373c15a051393
http://groups.google.com/group/comp.lang.fortran/msg/a732fb2849020fe3

The following program works if one replaces BESJ0 by ERF or ACOSH.

Error: 'kind' argument of 'cmplx' intrinsic at (1) must be a constant


After fixing the example, please check that also the long examples work.


program bug3
   implicit none
   real, parameter :: Qarg1 = 1.7
   integer, parameter :: k2 = kind(BESJ0(Qarg1))
   integer, parameter :: is_int = 1-1/(2+0*BESJ0(Qarg1))*2
   integer, parameter :: kind_if_real = &
      (1-is_int)*k2+is_int*kind(1.0)
   complex :: z = cmplx(0,1,kind_if_real) ! FAILS
   print *, kind_if_real  ! WORKS prints "4" (and dump is OK)
end program bug3


-- 
           Summary: Use MPFR for bessel function (optimization, rejects
                    valid F2008)
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: rejects-valid, missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list