public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/36117]  New: Use MPFR for bessel function (optimization, rejects valid F2008)
@ 2008-05-03 12:31 burnus at gcc dot gnu dot org
  2008-05-03 12:46 ` [Bug fortran/36117] " rguenth at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-05-03 12:31 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1950 bytes --]

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/36117] Use MPFR for bessel function (optimization, rejects valid F2008)
  2008-05-03 12:31 [Bug fortran/36117] New: Use MPFR for bessel function (optimization, rejects valid F2008) burnus at gcc dot gnu dot org
@ 2008-05-03 12:46 ` rguenth at gcc dot gnu dot org
  2008-05-03 14:01 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-05-03 12:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-05-03 12:46 -------
The frontend should emit calls to the gcc bultin functions which are properly
constant-folded.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/36117] Use MPFR for bessel function (optimization, rejects valid F2008)
  2008-05-03 12:31 [Bug fortran/36117] New: Use MPFR for bessel function (optimization, rejects valid F2008) burnus at gcc dot gnu dot org
  2008-05-03 12:46 ` [Bug fortran/36117] " rguenth at gcc dot gnu dot org
@ 2008-05-03 14:01 ` burnus at gcc dot gnu dot org
  2008-05-06 17:08 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-05-03 14:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2008-05-03 14:00 -------
> 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.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/36117] Use MPFR for bessel function (optimization, rejects valid F2008)
  2008-05-03 12:31 [Bug fortran/36117] New: Use MPFR for bessel function (optimization, rejects valid F2008) burnus at gcc dot gnu dot org
  2008-05-03 12:46 ` [Bug fortran/36117] " rguenth at gcc dot gnu dot org
  2008-05-03 14:01 ` burnus at gcc dot gnu dot org
@ 2008-05-06 17:08 ` burnus at gcc dot gnu dot org
  2008-05-06 17:09 ` burnus at gcc dot gnu dot org
  2008-05-09 12:16 ` zadeck at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-05-06 17:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2008-05-06 17:07 -------
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


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/36117] Use MPFR for bessel function (optimization, rejects valid F2008)
  2008-05-03 12:31 [Bug fortran/36117] New: Use MPFR for bessel function (optimization, rejects valid F2008) burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-05-06 17:08 ` burnus at gcc dot gnu dot org
@ 2008-05-06 17:09 ` burnus at gcc dot gnu dot org
  2008-05-09 12:16 ` zadeck at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-05-06 17:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2008-05-06 17:09 -------
FIXED on the trunk (4.4.0).


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/36117] Use MPFR for bessel function (optimization, rejects valid F2008)
  2008-05-03 12:31 [Bug fortran/36117] New: Use MPFR for bessel function (optimization, rejects valid F2008) burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-05-06 17:09 ` burnus at gcc dot gnu dot org
@ 2008-05-09 12:16 ` zadeck at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: zadeck at gcc dot gnu dot org @ 2008-05-09 12:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from zadeck at gcc dot gnu dot org  2008-05-09 12:15 -------
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


-- 


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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-05-09 12:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-03 12:31 [Bug fortran/36117] New: Use MPFR for bessel function (optimization, rejects valid F2008) burnus at gcc dot gnu dot org
2008-05-03 12:46 ` [Bug fortran/36117] " rguenth at gcc dot gnu dot org
2008-05-03 14:01 ` burnus at gcc dot gnu dot org
2008-05-06 17:08 ` burnus at gcc dot gnu dot org
2008-05-06 17:09 ` burnus at gcc dot gnu dot org
2008-05-09 12:16 ` zadeck at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).