Skip to content

Commit f68475b

Browse files
author
jamesbruten
committed
ticket:158 : stevemullerworth : Do not initialise pointers to enable thread-safe LFRic use : defect : general : regression : minor
git-svn-id: https://metomi/svn/socrates.xm/main/trunk@1563 7a691fcb-5d1e-4fc1-8b6b-54125fa6be09
1 parent 1fecfea commit f68475b

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

src/cosp_control/cosp_mod.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ subroutine cosp( nlevels, &
175175
type(cosp_column_inputs) :: cosp_column_in
176176

177177
type(cosp_outputs), target :: cosp_out_int
178-
type(cosp_outputs), pointer :: cosp_out => null()
178+
type(cosp_outputs), pointer :: cosp_out
179179

180180
character(len=256) :: cosp_status(100)
181181

src/interface_core/socrates_runes.F90

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,10 +609,10 @@ subroutine runes(n_profile, n_layer, diag, &
609609

610610

611611
! Spectral data:
612-
type(StrSpecData), pointer :: spec => null()
612+
type(StrSpecData), pointer :: spec
613613

614614
! Mcica data:
615-
type(StrMcica), pointer :: mcica => null()
615+
type(StrMcica), pointer :: mcica
616616
type(StrMcica), target :: mcica_dummy
617617

618618
! Controlling options:
@@ -643,6 +643,7 @@ subroutine runes(n_profile, n_layer, diag, &
643643
character (len=errormessagelength) :: cmessage
644644
character (len=*), parameter :: RoutineName = 'RUNES'
645645

646+
nullify(spec, mcica)
646647

647648
if (present(spectrum_name)) then
648649
do id_spec=1, size(spectrum_array)

src/interface_core/socrates_set_spectrum.F90

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ subroutine set_spectrum(n_instances, spectrum, spectrum_name, spectral_file, &
6565
real(RealExt), intent(in), optional :: wavelength_blue
6666

6767
! Local variables
68-
type(StrSpecData), pointer :: spec => null()
68+
type(StrSpecData), pointer :: spec
6969
integer, parameter :: nd_instances = 2
7070
integer :: id_spec
7171
integer :: ierr = i_normal
@@ -79,6 +79,8 @@ subroutine set_spectrum(n_instances, spectrum, spectrum_name, spectral_file, &
7979

8080
if (lhook) call dr_hook(ModuleName//':'//RoutineName,zhook_in,zhook_handle)
8181

82+
nullify(spec)
83+
8284
if (.not.allocated(spectrum_array)) then
8385
if (present(n_instances)) then
8486
allocate(spectrum_array(n_instances))
@@ -252,7 +254,7 @@ logical function retain_absorber(ip_absorber, l_absorber)
252254
implicit none
253255
integer, intent(in) :: ip_absorber
254256
logical, intent(in), optional :: l_absorber
255-
257+
256258
if (present(l_absorber)) then
257259
retain_absorber = (spec%gas%type_absorb(i) == ip_absorber) &
258260
.and. l_absorber
@@ -339,12 +341,13 @@ subroutine get_spectrum(spectrum_name, spectrum, &
339341
real(RealExt), allocatable, optional, intent(out) :: weight_blue(:)
340342

341343
! Local variables
342-
type(StrSpecData), pointer :: spec => null()
344+
type(StrSpecData), pointer :: spec
343345
integer :: id_spec
344346
integer :: ierr = i_normal
345347
character(len=errormessagelength) :: cmessage
346348
character(len=*), parameter :: RoutineName='GET_SPECTRUM'
347349

350+
nullify(spec)
348351

349352
do id_spec=1, size(spectrum_array)
350353
if (spectrum_array_name(id_spec) == spectrum_name) exit
@@ -404,9 +407,9 @@ subroutine set_mcica(mcica_data_file, sw_spectrum_name, lw_spectrum_name)
404407
character(len=*), intent(in), optional :: sw_spectrum_name, lw_spectrum_name
405408

406409
! Local variables
407-
type(StrSpecData), pointer :: sw_spec => null()
408-
type(StrSpecData), pointer :: lw_spec => null()
409-
type(StrMcica), pointer :: mcica => null()
410+
type(StrSpecData), pointer :: sw_spec
411+
type(StrSpecData), pointer :: lw_spec
412+
type(StrMcica), pointer :: mcica
410413
logical :: l_sw, l_lw
411414
integer :: id_spec, id_mcica
412415
integer :: ierr = i_normal
@@ -420,6 +423,8 @@ subroutine set_mcica(mcica_data_file, sw_spectrum_name, lw_spectrum_name)
420423

421424
if (lhook) call dr_hook(ModuleName//':'//RoutineName,zhook_in,zhook_handle)
422425

426+
nullify(sw_spec, lw_spec, mcica)
427+
423428
if (allocated(spectrum_array)) then
424429
if (.not.allocated(mcica_data_array)) then
425430
allocate(mcica_data_array(size(spectrum_array)))

0 commit comments

Comments
 (0)