This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR20880 - Failure to detect procedures encompassing own interface


Hi,

Grigory Zagorodnev wrote:
> My Fortran Standard knowledge is superficial to provide an opinion,
> but Intel Fortran compiler passes this code through.
> Is this new behavior correct or not?
I think gfortran is unnecessarily strict if the function "fpvs()" is not
used. But as soon as one tries to access fpvs() it is ambiguous which of
the two functions is meant and an error has to be issued.

Your example compiles with NAG f95, sunf95, g95 and ifort. However, as
soon as I try to access "fpvs()" it gives an error with all compilers
(here, the error message of ifort is shown):

fortcom: Error: fff.f90, line 18: The same named entity from different
modules and/or program units cannot be referenced.   [FPVS]
   print *, fpvs()
------------^

One still needs to check the Fortran standard to see whether the other
compilers support an extension or gfortran it too jealous.

The relevant part of F2003 is in Section 11.2.1 (and in Section 11.3.2
for Fortran 95); excerpt:

"Two or more accessible entities, other than generic interfaces or
defined operators, may have the same
identifier only if the identifier is not used to refer to an entity in
the scoping unit. Generic interfaces and
defined operators are handled as described in section 16.2.3. Except for
these cases, the local identifier
of any entity given accessibility by a USE statement shall differ from
the local identifiers of all other
entities accessible to the scoping unit through USE statements and
otherwise."

At the moment I fail to see whether this allows or forbids it.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]