[patch, fortran] fixes for the EXIT intrinsic function (PR30933)

Steve Kargl sgk@troutmask.apl.washington.edu
Sat Feb 24 18:50:00 GMT 2007


On Sat, Feb 24, 2007 at 07:19:55PM +0100, Daniel Franke wrote:
> On Saturday 24 February 2007 13:29:36 Tobias Burnus wrote:
> >
> > In any case which of the following option should we choose for those
> > non-time critical functions which call C library functions? Currently,
> > we have a mixure of (i), and (iv).
> >
> > i. Add i1, i2, and i16 versions to libgfortran
> >
> > ii. Convert kind > 8 to integer(8) and kind < 4 to integer(4)
> >
> > iii. As POSIX defines "exit(int)" and sizeof(int) is on most systems "4"
> > convert everything to integer(4)
> >
> > iv. Convert everything to the default integer, i.e. integer(4) or
> > integer(8) depending whether -fdefault-integer-8 is used.
> >
> > While (iv) is the easiest, it somehow looks a bit arbitrary. I therefore
> > would prefer either of (i) to (iii), with (iii) seeming to be the
> > cleanest - at least if one uses the same kind as the C library does.

I think it depends on the INTENT of the arguments.  If the args are
INTENT(IN), then (iv) is probably best.  A user calling FUNC(1_1)
will see that FUNC works, but under the hood _gfortran_func_i4 or
_gfortran_func_i8 is called depending on -fdefault-integer-8. 
For INTENT(INOUT) or INTENT(OUT) args, we'll probably need to go
with (i).  This may be accomplished by wrappers around the current
implementations for func_i4 and/or func_i8.

> > (How does one ensure this?)
> 
> Additional question:
> 
> If a subroutine/function takes multiple integer arguments, how many calls 
> should be considered valid?
> 
>  a) all possible combinations (i1/i1, i1/i2, i1/i4, ..., i8/i4, i8/i8)
>  b) only those with matching types (i1/i1, i2/i2, i4/i4, i8/i8)
> 

I prefer (b).  For many F95 intrinsics, this is the specified behavior,
and so we'll be consistent with the standard.

-- 
Steve



More information about the Fortran mailing list