RFC: Implementing FSEEK intrinsic, ErrLabel optional argument

Brooks Moses brooks.moses@codesourcery.com
Sun Dec 17 09:37:00 GMT 2006


There's currently only one G77 intrinsic not implemented in GFortran -- 
the FSEEK instrinsic.  The specification for this in G77 is

   CALL FSeek(Unit, Offset, Whence, ErrLab)

where ErrLab is an optional argument described as "'*label', where label 
is the label of an executable statement."

Steve and I talked about this a bit on IRC earlier this evening, and 
were strongly considering implementing this with the error label ignored 
(and letting the subroutine just abort on error conditions) because of 
the complexities involved in such a thing, but after not thinking about 
it for a while, I realized there's already a mechanism in place for 
handling exactly this: alternate returns from subroutines.  I should 
have known, of course, because that's why it's "*label" and not just 
"label".

(Admittedly, an optional alternate-return argument isn't exactly allowed 
by the standard, but we can probably finesse it for an intrinsic.)

There aren't any existing intrinsics that have alternate returns, are 
there?  Does anyone have any handy suggestions for how to go about 
writing one that does?

Thanks,
- Brooks



More information about the Fortran mailing list