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
The frontend should emit calls to the gcc bultin functions which are properly constant-folded.
> The frontend should emit calls to the gcc bultin functions which are properly > constant-folded. I think this already happens. The problem is that the information is needed much, much earlier: In initialization expressions, here, the front end needs to know result of the expression for other front-end stuff - such as deciding whether a REAL(4) or REAL(8) number is requested.
Subject: Bug 36117 Author: burnus Date: Tue May 6 17:06:54 2008 New Revision: 134988 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134988 Log: 2008-05-06 Tobias Burnus <burnus@net-b.de> PR fortran/36117 * intrinsic.c (add_functions): Call gfc_simplify_bessel_*. * intrinsic.h: Add prototypes for gfc_simplify_bessel_*. * simplify.c (gfc_simplify_bessel_j0,gfc_simplify_bessel_j1, gfc_simplify_bessel_jn,gfc_simplify_bessel_y0, gfc_simplify_bessel_y1,gfc_simplify_bessel_yn): New. 2008-05-06 Tobias Burnus <burnus@net-b.de> PR fortran/36117 * gfortran.dg/bessel_2.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/bessel_2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/intrinsic.c trunk/gcc/fortran/intrinsic.h trunk/gcc/fortran/simplify.c trunk/gcc/testsuite/ChangeLog
FIXED on the trunk (4.4.0).
Subject: Bug 36117 Author: zadeck Date: Fri May 9 12:14:57 2008 New Revision: 135113 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135113 Log: 2008-05-08 Kenneth Zadeck <zadeck@naturalbridge.com> PR middle-end/36117 * dce.c (deletable_insn_p): Do not delete calls if df_in_progress. (delete_unmarked_insns): When deleting a call, call delete_unreachable_blocks. * rtl.texi (RTL_CONST_CALL_P, RTL_PURE_CALL_P, RTL_CONST_OR_PURE_CALL_P, RTL_LOOPING_CONST_OR_PURE_CALL_P): Fixed doc. Modified: trunk/gcc/ChangeLog trunk/gcc/dce.c trunk/gcc/doc/rtl.texi
Comment #5 was really for PR36177