[FLASH-USERS] Bug in Particles_data.F90?

Klaus Weide klaus at flash.uchicago.edu
Wed May 6 16:11:46 EDT 2015


On Wed, 6 May 2015, Thomas Peters wrote:

> Dear FLASH developers,
> 
> I think I have found a bug in the Particles_data.F90 file. In the lines
> 
>   integer, dimension(PART_ATTR_DS_SIZE,MDIM) ::
> pt_velAttrib,pt_velPredAttrib
>   integer, dimension(MDIM) :: pt_posAttrib,pt_posPredAttrib
>   integer, dimension(PART_TYPE_INFO_SIZE,NPART_TYPES) :: pt_typeInfo
> 
> the "save" attribute is missing for all variables. This means that after
> initialization of the variables, the assigned values may get lost once
> the variables run out of scope. All the other variables in the module do
> have this attribute, so I assume it is necessary.

Thomas,

I agree that these variables should be given the SAVE attribute 
explicitly, at least for consistency and for strict standard conformance.
(Btw. one way to do this would be adding a SAVE statement - without a list 
of variables - somewhere in the module.)

I think it is very unlikely that the omission has caused any real 
problems. While compilers are allowed(*) to "lose values" of module 
variables without SAVE attribute in certain circumstances, none have 
implemented this AFAIK.

(*) In Fortran versions before 2008.
In the Fortran 2008 standard, all module variables have the SAVE 
attributes automatically, whether specified or not.

Klaus



More information about the flash-users mailing list