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

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



Hello Steve,

Thanks for your quick reply!

> Because your fix can't hurt, however, we modified our code accordingly
> and the modification will be in the next release.

Thanks.

> 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 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!

-- 

-----------------------------------------------------------------------
         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/
-----------------------------------------------------------------------