https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85352
Bug ID: 85352 Summary: Incorrect error diagnosed for dummy argument used in specification expression to subprogram with ENTRY Product: gcc Version: 7.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: mecej4 at outlook dot com Target Milestone: --- Created attachment 43912 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43912&action=edit fortran free form source code There are some old codes (e.g., RMAT SWMOL3 - Molecule-Sweden code) in which there are subroutines with ENTRY statements. A dummy argument to the ENTRY name is allowed in specification expressions; F2003 12.5.2.4 says: "If a dummy argument is used in a specification expression to specify an array bound or character length of an object, the appearance of the object in a statement that is executed during a procedure reference is permitted only if the dummy argument appears in the dummy argument list of the procedure name referenced and it is present (12.4.1.6)." I constructed the example code to mimic the SWMOL3 code http://www.tampa.phys.ucl.ac.uk/rmat/old/swmol3.f . G95, Intel Fortran 18 and Lahey-Fujitsu 7.1 compile the example code with no error messages. Gfortran 7.2.1 20170915 (Red Hat 7.2.1-2) (GCC) says: "sh-4.4$ gfortran -c bug.f90 bug.f90:17:27: CALL acomp(Sabb,nuca) 1 Error: Variable 'nuc1', used in a specification expression, is referenced at (1) before the ENTRY statement in which it is a parameter bug.f90:17:27: "