On Tue, 2012-07-31 at 11:33 +1200, John Harper wrote:
> On Mon, 30 Jul 2012, Van Snyder wrote:
>
> > Date: Mon, 30 Jul 2012 15:40:57 -0700
> > From: Van Snyder <[log in to unmask]>
> > Reply-To: Fortran 90 List <[log in to unmask]>
> > To: [log in to unmask]
> > Subject: Re: Can anyone reproduce this bug?
> >
> > On Tue, 2012-07-31 at 10:28 +1200, John Harper wrote:
> >> Is that program not standard-conforming, or has g95 a bug?
> >
> > A simplification of John's program:
> >
> > module M
> > intrinsic HUGE
> > end module M
> > program P
> > use M, only: BIG => HUGE
> > print *, big(1), big(1.0e0), big(1.0d0)
> > end program P
> >
> > works as I would expect it to with ifort version 11.0 Build 20090131 and
> > 12.0 Build 20101116, NAG version 5.2(668), gfortran version 4.4.6
> > 20110731, and LF95 version L6.20e.
> >
> > I don't have g95.
> >
> > Offhand, I'd say that g95 has a bug if it fails for this program, in
> > which HUGE is explicitly declared in M to be intrinsic.
>
> That program worked OK with g95. So did my original program after I put
> intrinsic HUGE in its module. The remaining question is whether the
> Fortran standard requires intrinsic HUGE in the module. If so, g95 was
> my only compiler that found the bug in the program that omitted that
> statement. If not, g95 has a bug. But there are other possibilities,
> given that all the compilers claim to comply with the f95 standard
> and include various f2003 and f2008 features: that the three standards
> disagree on the requirement for intrinsic HUGE, or that at least one of
> them is ambiguous on the matter.
List item (1) of subclause 16.3.1 of the 2008 standard says that the
name of an intrinsic function is a local identifier of class 1. Where
an intrinsic function is referenced as an inquiry function in a module,
That makes the name of the intrinsic function a local identifier within
that module. As long as it doesn't have the PRIVATE attribute, it's
accessible by USE association. The entity accessed from that module by
that name is the generic intrinsic function, not one specific instance
of it.
This list item is in subclause 14.1.2 in the 1995 standard, and 16.2 in
the 2003 standard, and "intrinsic procedure" is in both those list
items. I don't think there's any conflict or ambiguity between the
standards. It looks like g95 has a bug.
> -- John Harper, School of Mathematics Statistics and Operations Research
> Victoria University, PO Box 600, Wellington 6140, New Zealand
> e-mail [log in to unmask] phone (+64)(4)463 5276 fax (+64)(4)463 5045
|