[PATCH] more g77 runtime library functions for gfortran
Paul Brook
paul@codesourcery.com
Wed Aug 18 21:22:00 GMT 2004
On Wednesday 18 August 2004 21:53, Steve Kargl wrote:
> On Wed, Aug 18, 2004 at 02:07:45AM +0100, Paul Brook wrote:
> > On Saturday 14 August 2004 20:51, Steve Kargl wrote:
> > > This patch implements the following nonstandard intrinsic
> > > functions included in the g77 runtime library:
> > >
> > > ? DFLOAT ? -- convert an integer to double precision
> > > ? [D]BESJ0 -- Bessel function of order 0 and real argument
> > > ? [D]BESJ1 -- Bessel function of order 1 and real argument
> > > ? [D]BESJN -- Bessel function of order N and real argument
> > > ? [D]BESY0 -- Bessel function of order 0 and real argument
> > > ? [D]BESY1 -- Bessel function of order 1 and real argument
> > > ? [D]BESYN -- Bessel function of order N and real argument
> >
> > 3) The parameters to the library functions should be passed by value, not
> > by reference.
>
> I have no idea what you want here.
You declare the library functions as
besj0 (GFC_REAL_4 *x)
It would be much more efficient to use
besj0 (GFC_REAL_4 x)
All the arguments are intent(in), so there's no reason to pass them by
reference. Obviously this will need corresponding code in trans-intrinsic.c.
> > 4) Is using these intrinsics as actual arguments supposed to work?
> > (it doesn't). Maybe this was the reasoning behind (3)?
>
> Copy and paste problem. I forgot to change the 1 to 0.
Ok.
> > 5) I don't think a warning/error is the correct behaviour for --std=f95.
> > Wouldn't it be better to disable the intrinsic altogether? A warning may
> > be a good idea, but it's not what I'd expect in strict standard compliant
> > mode.
>
> Disabling the intrinsics is not possible with the current implementation
> of intrinsics in gfortran. When gfortran is built, two lists of intrinsics
> procedure names are created. AFAICT, there is no way to mark a member of a
> list to be ignored if -std=f95.
>
> We could add member to the gfc_intrinsic_sym struct to annotate which
> standard specifies the intrinsics, and then rebuild the lists of
> procedure names at run time. I don't see this happen any time soon.
I never said it would be easy to implement :)
It seems it would be much easier to implement if you moved the logic a bit
earlier. Don't build multiple lists, then deciding which ones we want.
Instead only add the intrinsics that are enabled in the first place.
Pass an extra argument to add_sym in intrinsic.c, and have it return without
doing anything if it it doesn't match the currently enabled set of
intrinsics.
Or you could just put if (something) round bits of add_functions and
add_subroutines.
Paul
More information about the Fortran
mailing list