[Bug fortran/27112] Rejects to call a generic procedure by argument keywords.

1fhcwee02 at sneakemail dot com gcc-bugzilla@gcc.gnu.org
Thu Apr 13 15:51:00 GMT 2006



------- Comment #6 from 1fhcwee02 at sneakemail dot com  2006-04-13 15:51 -------
I was asked about this yesterday. I see my comments didn't make it here, so
I'll try putting them in myself with this new account. (No, I can't monitor bug
reports with any regularity; I can't even really keep up with the mailing
list.)

This is not a bug. The code is nonstandard and the compiler is acting exactly
as specified by the standard. Actualy, even the summary line is wrong, and in a
way that illustrates the misunderstanding here. The compiler is not rejecting
the call; the error is at the USE statements, before the call even comes into
play.

See 14.1.2.3 of the f95 standard. That's where the relevant material is. Some
cases of disambiguation are tricky and can't be reasoned out without checking
the exact words of the standard (just because a human can see how to
disambiguate something, that doesn't mean it is standard conforming, so you
have to actually check the standard rather than figure out whether you could
disambiguate it). But this case is trivial, and the whole point is the
misunderstanding illustrated by the summary line.

A generic is required to be unambigous under *ALL* possible calls. It isn't
even relevant what particular calls are made. An illegal generic is illegal
even if it isn't called at all. In particular, a generic is required to be
unambiguous under both keyword and positional forms. There is even a tricky
condition relating to mixed cases, but this example doesn't get into that. This
example is trivially ambiguous in positional form. Again, it doesn't matter
that there are no such positional calls; the generic itself is what is illegal
- not the calls.

For the exact citation, see the word "both" on line 24 of page 277 of f95.

I note as an aside that even though the OP noted that the Intel compiler
"disagreed" with gfortran, the data he posted does not support that statement.
The Intel compiler also caught the problem, the only distinction being that at
least one version appears to treat it as a warning instead of a fatal error. IN
any case, regardless of what any other compiler might do, the code is
nonstandard. I also note that this kind of extension is exceedingly dangerous
to count on - more so than many extensions - because it has high odds of having
conflicts with future enhaancements to the standard. Generic disambiguation has
subtle rules and there are many (sometimes conflicting) proposals to enhance
them.

I think this bug should be marked as "invalid", but I'll leave that call to
others, as you could consider it an enhancement request for an extension. I'd
advise against such an extension, but that's not my call.


-- 

1fhcwee02 at sneakemail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |1fhcwee02 at sneakemail dot
                   |                            |com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27112



More information about the Gcc-bugs mailing list