[Dart-dev] [3652]
DART/trunk/location/threed_sphere/location_mod.f90:
Adjust the query_location()
code slightly to avoid a 16-byte character local
nancy at ucar.edu
nancy at ucar.edu
Tue Nov 11 16:26:01 MST 2008
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20081111/5a6f6138/attachment.html
-------------- next part --------------
Modified: DART/trunk/location/threed_sphere/location_mod.f90
===================================================================
--- DART/trunk/location/threed_sphere/location_mod.f90 2008-11-07 23:21:51 UTC (rev 3651)
+++ DART/trunk/location/threed_sphere/location_mod.f90 2008-11-11 23:25:59 UTC (rev 3652)
@@ -564,28 +564,36 @@
character(len=*), optional, intent(in) :: attr
real(r8) :: fval
-character(len=16) :: attribute
-
if ( .not. module_initialized ) call initialize_module
-attribute = 'which_vert'
+! Workaround for apparent bug in mac osx intel 10.x fortran compiler.
+! Previous code had a 16 byte local character variable which was
+! apparently not getting deallocated after this function returned.
+! This code, while it has redundant default lines (attr not present
+! and the case default) does not exhibit the leak.
-if (present(attr)) attribute = attr
-selectcase(adjustl(attribute))
- case ('which_vert','WHICH_VERT')
+if (.not. present(attr)) then
fval = loc%which_vert
- case ('lat','LAT')
- fval = loc%lat
- case ('lon','LON')
- fval = loc%lon
- case ('vloc','VLOC')
- fval = loc%vloc
- case default
- fval = loc%which_vert
-end select
+else
+ selectcase(adjustl(attr))
+ case ('which_vert','WHICH_VERT')
+ fval = loc%which_vert
+ case ('lat','LAT')
+ fval = loc%lat
+ case ('lon','LON')
+ fval = loc%lon
+ case ('vloc','VLOC')
+ fval = loc%vloc
+ case default
+ fval = loc%which_vert
+ end select
+
+endif
+
end function query_location
+
subroutine write_location(ifile, loc, fform)
!----------------------------------------------------------------------------
!
More information about the Dart-dev
mailing list