[Patch, fortran] PR30236 - alternate-return subroutine in generic interface causes ice/segfault

Brooks Moses brooks.moses@codesourcery.com
Mon Dec 18 08:30:00 GMT 2006


Paul Thomas wrote:
> A wrinkle here is whether or not this is valid fortran.  Most compilers 
> that I have access to seem to quietly compile this..... well, noisily, 
> actually, since they complain about the obsolescent feature, but compile 
> it they do.  However, in the thread on comp.lang.fortran;
> http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/5f5079d3fe7e534a/846f950fdb70767f#846f950fdb70767f
> Michael Metcalf offers the advice that this is invalid because the 
> alternate returns are not data object arguments and should not be counted.
> 
> Brooks, as reporter and correspondent on the fortran thread, what do you 
> think?  Is this a -std=gnu or unconditionally an error?

There's a tiny-but-significant difference between this testcase and what 
I described on the comp.lang.fortran thread.  This case is unambiguously 
legal (unless I'm missing something like "alternate returns are not 
allowed in generic interfaces at all", which Mike's answer on to my 
question on c.l.f. implies that I'm not).

Specifically, in the testcase here, the two specific subroutines have 
argument lists like so:

> +   subroutine with(i,*)
> +   subroutine without()

These are distinguishable even if the alternate-return dummy argument is 
ignored.  The c.l.f. question applied to the more subtle case where the 
second one has an argument list of "(i)", so the alternate-return is the 
_only_ difference; that's why that case was arguably illegal.

So, yeah, the code in the testcase in your patch is completely valid.

- Brooks



More information about the Fortran mailing list