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

From: Scott Brozell <>
Date: Thu, 30 Sep 2010 13:45:40 -0400


Dave and Ross should read the link i provided before:
'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.


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 <> 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
Received on Thu Sep 30 2010 - 11:00:06 PDT
Custom Search