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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-02-12 
09:47:53 UTC ---
The first example is rejected by ifort (12.0? with a warning - but works) and
NAG (5.1, 5.2? - error); crayftn and gfortran accept it.
The second example by Janus is accepted by gfortran, NAG 5.1 (both call
baseproc1) and by Crayftn (calls baseproc2) - I have not checked with ifort 12
(ifort 11.1 does not support TBP GENERIC).
(Both programs are rejected by PGI 10.5 at a different place which looks like a
compiler bug.)

 * * *

In Fortran 2008, this is covered by C1215 in "12.4.3.4.5 Restrictions on
generic declarations".

To valid, a program needs to fulfil one of the items (1) to (3); I agree with
Richard Maine that the following should be fulfilled for the first program:

"(1) there is a non-passed-object dummy data object in one or the
 other of them such that
    (a) the number of dummy data objects in one that are nonoptional,
        are not passed-object, and with which that dummy data object is TKR
        compatible, possibly including that dummy data object itself,
    exceeds
    (b) the number of non-passed-object dummy data objects, both optional
        and nonoptional, in the other that are not distinguishable from
        that dummy data object,"

"baseproc_nopass" has *one* nonoptional "non-passed-object dummy" this exceeds
the number of "non-passed-object dummy data objects" of "baseproc_pass", which
has no non-passed-object dummy. Hence, the program should be valid.

For Janus's program, both have exactly the same number of non-passed-object
dummies: Namely one. "(2)" does not apply as only one has "pass" and "(3)" also
does not seem to be fulfilable. Hence, the program should be invalid.

Reply via email to