public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: fortran/3807: Function BESJN(integer,double) problems
@ 2002-01-14 15:47 billingd
  0 siblings, 0 replies; 4+ messages in thread
From: billingd @ 2002-01-14 15:47 UTC (permalink / raw)
  To: David.Billinghurst, gcc-bugs, gcc-prs, nobody

Synopsis: Function BESJN(integer,double) problems

State-Changed-From-To: analyzed->closed
State-Changed-By: billingd
State-Changed-When: Mon Jan 14 15:47:58 2002
State-Changed-Why:
    Fixed in 3.1
    http://gcc.gnu.org/ml/gcc-patches/2002-01/msg00802.html

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3807


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

* Re: fortran/3807: Function BESJN(integer,double) problems
@ 2002-01-14 15:46 Billinghurst, David (CRTS)
  0 siblings, 0 replies; 4+ messages in thread
From: Billinghurst, David (CRTS) @ 2002-01-14 15:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR fortran/3807; it has been noted by GNATS.

From: "Billinghurst, David (CRTS)" <David.Billinghurst@riotinto.com>
To: <gcc-gnats@gcc.gnu.org>
Cc:  
Subject: Re: fortran/3807: Function BESJN(integer,double) problems
Date: Tue, 15 Jan 2002 07:35:15 +0800

 Also http://gcc.gnu.org/ml/gcc-patches/2002-01/msg00802.html
 
 While working on tests for Bessel functions, I found some problems with
 intrinsic functions BESJN and BESYN.  I am not sure it they are bugs or
 documentation issues.
 
 g77 is upset about the return type of BESJN(i,x) for double precision x.
 The documentation indicates that the return type is that of the second
 argument d. =20
 
 The source, in intrin.def agrees, with=20
 DEFIMP  (BESJN,"BESJN",L_BESJN,,,"R=3D:1:N=3DI*,X=3DR*")
 
 The problem lies in f/intrin.c.  The code around line 620 does not
 handle the case when the return type is specified by the second argument
 ":1:".  The only cases handled are:
  - ":-:" explicit return type
  - ":*:" return type depends on all args
  or it defaults to the first argument
 
 This patch fixes most of the cases, but the cases where the first
 argument is integer*8 still fail.  I think I have convinced myself this
 is a different bug.
 
 Tested on i686-pc-cygwin
 
 2001-01-12  David Billinghurst <David.Billinghurst@riotinto.com>
 
 	PR fortran/3807
 	* f/intrin.c (ffeintrin_check_):  Allow for case of intrinsic
 	control string have COL-spec an integer > 0
 	testsuite/g77.f-torture/execute/intrinsic-unix-bessel.f:
 	Uncomment additional cases that now pass
 
 Index: f/intrin.c
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file: /cvs/gcc/gcc/gcc/f/intrin.c,v
 retrieving revision 1.20
 diff -u -p -r1.20 intrin.c
 --- intrin.c    2001/10/21 21:32:07     1.20
 +++ intrin.c    2002/01/11 13:07:00
 @@ -622,10 +622,11 @@ ffeintrin_check_ (ffeintrinImp imp, ffeb
      {
        bool okay =3D TRUE;
        bool have_anynum =3D FALSE;
 +      int  arg_count=3D0;
 
 -      for (arg =3D args;
 +      for (arg =3D args, arg_count=3D0;
            arg !=3D NULL;
 -          arg =3D (c[colon + 1] =3D=3D '*') ? ffebld_trail (arg) : =
 NULL)
 +          arg =3D ffebld_trail (arg), arg_count++ )
         {
           ffebld a =3D ffebld_head (arg);
           ffeinfo i;
 @@ -635,6 +636,9 @@ ffeintrin_check_ (ffeintrinImp imp, ffeb
             continue;
           i =3D ffebld_info (a);
 
 +          if ( c[colon+1] !=3D '*' && (c[colon+1]-'0') !=3D arg_count )
 +            continue;
 +
           anynum =3D (ffeinfo_basictype (i) =3D=3D =
 FFEINFO_basictypeHOLLERITH)
             || (ffeinfo_basictype (i) =3D=3D FFEINFO_basictypeTYPELESS);
           if (anynum)
 Index: testsuite/g77.f-torture/execute/intrinsic-unix-bessel.f
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 RCS file:
 /cvs/gcc/gcc/gcc/testsuite/g77.f-torture/execute/intrinsic-unix-besse.f,
 v
 retrieving revision 1.1
 diff -u -p -r1.1 intrinsic-unix-bessel.f
 --- intrinsic-unix-bessel.f     2001/07/24 13:32:53     1.1
 +++ intrinsic-unix-bessel.f     2002/01/11 13:07:01
 @@ -39,11 +39,11 @@ c     BESJN  - Bessel function of first
        a =3D 0.3528340
        da =3D a
        call c_r(BESJN(i,x),a,'BESJN(integer,real)')
 -c      call c_r(BESJN(j,x),a,'BESJN(integer*2,real)')
 -c      call c_r(BESJN(k,x),a,'BESJN(integer*1,real)')
 +      call c_r(BESJN(j,x),a,'BESJN(integer*2,real)')
 +      call c_r(BESJN(k,x),a,'BESJN(integer*1,real)')
  c      call c_r(BESJN(m,x),a,'BESJN(integer*8,real)')
 -c      call c_d(BESJN(i,dx),da,'BESJN(integer,double)')
 -c      call c_d(BESJN(j,dx),da,'BESJN(integer*2,double)')
 +      call c_d(BESJN(i,dx),da,'BESJN(integer,double)')
 +      call c_d(BESJN(j,dx),da,'BESJN(integer*2,double)')
        call c_d(BESJN(k,dx),da,'BESJN(integer*1,double)')
  c      call c_d(BESJN(m,dx),da,'BESJN(integer*8,double)')
        call c_d(DBESJN(i,dx),da,'DBESJN(integer,double)')
 @@ -69,11 +69,11 @@ c     BESYN  - Bessel function of second
        a =3D -0.6174081
        da =3D a
        call c_r(BESYN(i,x),a,'BESYN(integer,real)')
 -c      call c_r(BESYN(j,x),a,'BESYN(integer*2,real)')
 -c      call c_r(BESYN(k,x),a,'BESYN(integer*1,real)')
 +      call c_r(BESYN(j,x),a,'BESYN(integer*2,real)')
 +      call c_r(BESYN(k,x),a,'BESYN(integer*1,real)')
  c      call c_r(BESYN(m,x),a,'BESYN(integer*8,real)')
 -c      call c_d(BESYN(i,dx),da,'BESYN(integer,double)')
 -c      call c_d(BESYN(j,dx),da,'BESYN(integer*2,double)')
 +      call c_d(BESYN(i,dx),da,'BESYN(integer,double)')
 +      call c_d(BESYN(j,dx),da,'BESYN(integer*2,double)')
        call c_d(BESYN(k,dx),da,'BESYN(integer*1,double)')
  c      call c_d(BESYN(m,dx),da,'BESYN(integer*8,double)')
        call c_d(DBESYN(i,dx),da,'DBESYN(integer,double)')
 
 
 


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

* Re: fortran/3807: Function BESJN(integer,double) problems
@ 2001-07-26  2:29 toon
  0 siblings, 0 replies; 4+ messages in thread
From: toon @ 2001-07-26  2:29 UTC (permalink / raw)
  To: David.Billinghurst, gcc-bugs, gcc-prs, nobody

Synopsis: Function BESJN(integer,double) problems

State-Changed-From-To: open->analyzed
State-Changed-By: toon
State-Changed-When: Thu Jul 26 02:29:03 2001
State-Changed-Why:
    The function ffeintrin_check_ in f/intrin.c is miscompiled.
    As a consequence, the `colon' variable that follows the
    intrinsic's description gets a wrong value.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3807&database=gcc


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

* fortran/3807: Function BESJN(integer,double) problems
@ 2001-07-24 23:46 David.Billinghurst
  0 siblings, 0 replies; 4+ messages in thread
From: David.Billinghurst @ 2001-07-24 23:46 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3807
>Category:       fortran
>Synopsis:       Function BESJN(integer,double) problems
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 24 23:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     David Billinghurst
>Release:        gcc 2.95 and 3.1
>Organization:
>Environment:
mips-sgi-irix6.5 and i686-pc-cygwin
>Description:
While working on tests for Bessel functions, I found some problems with intrinsic functions BESJN and BESYN.  I am not sure it they are bugs or documentation issues.

g77 is upset about the return type of BESJN(i,x) for double precision x.  The documentation indicates that the return type is that of the second argument d.  

The source, in intrin.def agrees, with 
DEFIMP	(BESJN,"BESJN",L_BESJN,,,"R=:1:N=I*,X=R*")

Have a look at the tests commented out in g77.f-torture/execute/intrinsic-unix-bessel.f for the full set of problems.
One case is:

c From g77.f-torture/execute/intrinsic-unix-bessel.f
c
c     David Billinghurst <David.Billinghurst@riotinto.com>
c
      double precision dx, da
      dx = 2.0d0
      da = 0.3528340d0
      call c_d(BESJN(2,dx),da)
      end

      subroutine c_d(a,b)
      double precision a, b
      if ( abs(a-b) .gt. 1.0d-5 ) then
         write(6,*) 'a = ', a
         write(6,*) 'b = ', b
         call abort
      end if
      end

When compiled on mips-sgi-irix6.5

g77 -Wall -o bug1 bug1.f
bug1.f: In subroutine `c_d':
bug1.f:8: warning:
         call c_d(BESJN(2,dx),da)
              1
bug1.f:11: (continued):
         subroutine c_d(a,b)
                    2
Argument #1 (named `a') of `c_d' is one precision at (2) but is some other precision at (1) [info -f g77 M GLOBALS]


and when run

./bug1
 a =   1.23089654E-06
 b =   0.352834
Fortran abort routine called
Abort (core dumped)

>How-To-Repeat:
Run the test case above
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-01-14 23:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-14 15:47 fortran/3807: Function BESJN(integer,double) problems billingd
  -- strict thread matches above, loose matches on Subject: below --
2002-01-14 15:46 Billinghurst, David (CRTS)
2001-07-26  2:29 toon
2001-07-24 23:46 David.Billinghurst

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).