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

From: Crowley, Michael <Michael.Crowley.nrel.gov>
Date: Thu, 30 Sep 2010 11:10:28 -0600

I have actually been burned by this, where an intent(out) was used and the compiler produced code that ignored the value of the variable coming in. It was a bear to figure out where the problem was coming from, but it was the intent(out) that should have been intent(inout). I can't remember what compiler/machine it was on, perhaps it is rare enough that you do not want to go the bugfix route for two letters, but in general I would err on the side of bug.
Mike

On 9/30/10 10:13 AM, "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
warnings and everything would run fine regardless of which compiler you use.

This may of course change in the future so we can't rely on it but I'm not
sure it is critical as a bugfix. I am certain there is more than just the
one example of misuse of intent in the code anyway so probably the one bug
fix won't solve the issue if compiler behavior does actually end up
changing.

But it is certainly worthwhile changing any incorrect entries you come
across in the git tree.

Just my 3c.

All the best
Ross

/\
\/
|\oss Walker

---------------------------------------------------------
| Assistant Research Professor |
| San Diego Supercomputer Center |
| Adjunct Assistant Professor |
| Dept. of Chemistry and Biochemistry |
| University of California San Diego |
| NVIDIA Fellow |
| http://www.rosswalker.co.uk | http://www.wmd-lab.org/ |
| Tel: +1 858 822 0854 | EMail:- ross.rosswalker.co.uk |
---------------------------------------------------------

Note: Electronic Mail is not secure, has no guarantee of delivery, may not
be read every day, and should not be used for urgent or sensitive issues.




_______________________________________________
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:04 PDT
Custom Search