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: gfortran bug? USE and USE ONLY


Steve Kargl wrote:
> mobile:kargl[205] ./z
>  kind(xrenamed)==kind(x)? T
>  That should have printed F
>
> which I think is correct
I agree that "it" is correct, the question is only which of the two is
meant by "it" ;-)

I believe the program is correctly stating "That should have printed F"
and thus gfortran wrongly prints T.

> based on the statement from f95
>
>     More than one USE statement for a given module may appear in
>     a scoping unit.  If one of the USE statements is without an
>     ONLY qualifier, all public entities in the module are accessible.
>     If all the USE statements have ONLY qualifiers, only those
>     entities named in one or more of the only-lists are accessible.
>
> John's program makes 'x' available via the first USE statement
> and the rename in the 2nd USE statment does not make 'x' 
> unacessible to the program.
Renaming makes 'x' unavailable; quoting from Fortran 2003 (11.2.1):

"An accessible entity in the referenced module has one or more local
identifiers. These identifiers are
"(1) The identifier of the entity in the referenced module if that
identifier appears as an only use-name or as the defined-operator of a
generic-spec in any only for that module,
"(2) Each of the local-names or local-defined-operators that the entity
is given in any rename for that module, and
"(3) The identifier of the entity in the referenced module if that
identifier does not appear as a use-name or use-defined-operator in any
rename for that module."

As "x" is imported as "xrenamed" (case 2), case (3) does not apply and
"x" is not imported.

Therefore I believe this is a bug, which I filled as
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33541

Thanks John for spotting this bug.

Tobias


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