[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

20020425: bug report (+fix) for netcdf f90 library



Rolf,

>Date: Fri, 26 Apr 2002 09:03:27 +0200 (MET DST)
>From: Rolf Sander <address@hidden>
>Organization: Max-Planck Institute of Chemistry
>To: Steve Emmerson <address@hidden>
>Subject: Re: 20020425: bug report (+fix) for netcdf f90 library 
>Keywords: 200204251416.g3PEGpa11170

The above message contained the following:

> > Our Fortran-90 expert says, however, that the line in question is OK
> > because the right-hand-side is automatically reduced to the size of
> > the left-hand-side. We suspect, therefore, that your Fortran-90
> > compiler doesn't conform to the standard.
> 
> I wasn't quite sure about this myself so I looked it up. In the Compaq
> Fortran Language Reference Manual at
> http://www.cecalc.ula.ve/documentacion/tutoriales/CF95AU54/lrm0077.htm I
> found:
> 
> "Array assignment is permitted when the array expression on the right
> has the same shape as the array variable on the left, or the expression
> on the right is a scalar."
> 
> For the Lahey compiler, diferent lengths are only allowed for CHARACTER
> type.

I looked it up in our ISO Fortran-90 Standard.  The main thing I found
was the following regarding the assignment statement definition
    
        ASSIGNMENT-STMT is VARIABLE = EXPR

    7.5.1.4 Intrisic assignment conformance rules

    For an intrinsic assignment statement, VARIABLE must conform in
    shape, and if EXPR is an array, VARIABLE must also be an array. ...

So, I think you might be right.

> I think the effect you usually get is pretty much what you described:
> The variable will be assigned the reduced part of the big array.
> However, I fear that with range-check options switched off, the rest of
> the big array will be poked uncontrolled into some other part of the
> memory next to the small array. This may or may not confuse your program
> depending on what used to be stored there.
> 
> Anyway, I think with the changed code we're on the safe side.
> 
>                 Greetings
>                         Rolf
> 
> ps: Thanks for providing the netcdf interface. It's a big help for
>     storing my model output!

Our pleasure.  Thanks for the feedback.

> -----------------------------------------------------------------------
>          A new journal, a new concept: www.atmos-chem-phys.org
> -----------------------------------------------------------------------
>   Rolf Sander                               phone: [+49] 6131/305-449
>   Air Chemistry Department                    fax: [+49] 6131/305-436
>   Max-Planck Institute of Chemistry   email: address@hidden
>   PO Box 3060, 55020 Mainz, Germany    www.mpch-mainz.mpg.de/~sander/
> -----------------------------------------------------------------------

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>