Re: [AMBER-Developers] misused intent(out)

From: Ross Walker <ross.rosswalker.co.uk>
Date: Thu, 30 Sep 2010 10:56:20 -0700

Hi Scott,

Agreed.

My point is though that there is probably a lot more than just this one
instance. So if we are going to release a patch for this one perhaps we
should take a chunk of code each and go through and check it for use of
intent out and fix as appropriate. I actually think we should try to have a
code audit at some point, either at the developers meeting where several of
us can sit down without distraction or at separate meeting. We could make a
list of things we should check and then each go through a section of code
looking for such things.

My guess right now though is that 'real' compilers such as the SGI Irix MIPs
compilers probably used this intent statement properly but I certainly
haven't seen it with any recent versions of gfortran, ifort or pgf90. Not to
say it may be an issue at some point though so if people see these they
should fix them at the very least in the git tree.

All the best
Ross

> -----Original Message-----
> From: Scott Brozell [mailto:sbrozell.rci.rutgers.edu]
> Sent: Thursday, September 30, 2010 10:46 AM
> To: AMBER Developers Mailing List
> Subject: Re: [AMBER-Developers] misused intent(out)
>
> Hi,
>
> Dave and Ross should read the link i provided before:
> http://www.cs.rpi.edu/~szymansk/OOF90/bugs.html#2
> 'These "gotchas" are nasty because they will not fail on some machines,
> while failing on others (given various combinations of compilers and
machine
> platforms).'
> ...
> 'The problem is that when intent(out) is used with a derived type, any
> component not assigned in a procedure could become undefined on exit.'
>
> That group has a lot of Fortran experience, and my interpretation of
> their page is that it is based on real world use (but perhaps dated use).
> However, if you are sure that the tests exercise the relevant code
> and they pass with all the compilers configure supports then i would
> still issue a bugfix, but i imagine others would not. But the code
> still contains a lurking bug and does not conform to the standard.
>
> scott
>
> On Thu, Sep 30, 2010 at 12:18:39PM -0400, Jason Swails wrote:
> > This was what I figured -- especially since the major compilers we
support
> > give the same results whether it's out or inout. I just figured I'd
poll
> > the more experienced rather than rely on just my own assumptions. It is
> > still formally improper Fortran90, though, right?
> >
> > Thanks!
> > Jason
> >
> > On Thu, Sep 30, 2010 at 12:13 PM, Ross Walker <ross.rosswalker.co.uk>
> wrote:
> >
> > > Hi Jason,
> > >
> > > > Well intent(out) is applied to an array in which only a chunk of the
> > > array
> > > > is initialized (the charges of a single residue, or 2, are changed
in the
> > > > global charge array). According to the Fortran standard, I think
the
> > > rest
> > > > of the array is technically undefined. So it would be legitimate
> > > compiler
> > > > behavior to trash the remaining array values. If I'm mistaken here,
> > > please
> > >
> > > You would think this but I have never come across a compiler that
actually
> > > seems to make optimization decisions based on the use of an intent
> > > statement. As far as I can tell the most they are used for is at
compile
> > > time to issue a warning if an array with intent(out) is not actually
> > > written
> > > to in a routine. I am pretty sure you could change every single
variable in
> > > AMBER to just be intent(out) regardless of its actual use, ignore the
>
> _______________________________________________
> AMBER-Developers mailing list
> AMBER-Developers.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber-developers


_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Thu Sep 30 2010 - 11:00:08 PDT
Custom Search