This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] more g77 runtime library functions for gfortran


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
> 
> I have a few issues with this patch.
> 
> 1) The library functions should be named foo_r4 and foo_r8, not foo and dfoo.

Fixed.

> 2) The resolution functions are wrong. sizeof(float) is defined by the target 
> (currently assumed to be 4). kind(0.0) is selectable by the user at compile 
> time.

Fixed.  My fix uses the magic numbers 4 and 8 in a switch() construct.
This is no worse than the use of the magic numbers elsewhere in gfortran.
Although, these magic numbers are probably related to a SegFault I 
have with one of my test codes.  It compiles and runs on FreeBSD on
i386 hardware; while it compiles and dies on FreeBSD on AMD64 hardware. 

> 3) The parameters to the library functions should be passed by value, not by 
> reference.

I have no idea what you want here.

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

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


-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]