[Bug fortran/35476] New: Accepts invalid: USE/host association of generics with same specifics

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Mar 5 17:46:00 GMT 2008


Found the following on the J3 Fortran list. I think the program below is
invalid for the reasons given by Bill Long, but it has not finally decided yet
(on J3). (The question/program comes from Sun)

Current status:
- openf95 and sunf95 reject it
- ifort, gfortran, NAG f95, and g95 accept it
Bill Long writes that he tested two non-Sun compilers, of which two gave an
error and two did not.

Craig diged up from the standard:
| Use association is defined in section 11.2.1.  Host association is
| covered in section 16.4.1.3.  The second paragraph starts with this sentence
| [411:9-10]:  "If an entity that is accessed by use association has the same
| nongeneric name as a host entity, the host entity is inaccessible by that
| name."

However, as Bill notes:
| I think that issuing the error is valid.  Generic interfaces merge 
| together their lists of specifics when more than one with the same 
| generic name is visible.  Whether that visibility comes through host 
| association or use association should not matter.  Craig's citation from 
| f03 explicitly says "nongeneric" intentionally, and does not apply in 
| this case.

       MODULE M1
         INTERFACE SUBR
           MODULE PROCEDURE SUBR1
         END INTERFACE
       CONTAINS
         SUBROUTINE SUBR1
         END SUBROUTINE
       END

       MODULE M2
         INTERFACE SUBR
           MODULE PROCEDURE SUBR2
         END INTERFACE
       CONTAINS
         SUBROUTINE SUBR2
         END SUBROUTINE
       END

       PROGRAM MAIN
         USE M1
         CALL S
       CONTAINS
         SUBROUTINE S
           USE M2
           CALL SUBR
         END SUBROUTINE
       END


-- 
           Summary: Accepts invalid: USE/host association of generics with
                    same specifics
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list