Skip to content

Commit 333da8a

Browse files
sbryngelsonclaude
andcommitted
Fix loc_violations gaining implicit SAVE attribute
Initializing a local variable in its declaration gives it the SAVE attribute in Fortran, meaning it would not reset to zero on subsequent calls. Move the initialization to an executable assignment so the variable is properly zeroed each time the subroutine is entered. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 45e9c1b commit 333da8a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/pre_process/m_data_output.fpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,13 +476,15 @@ contains
476476

477477
! Generic loop iterators
478478
integer :: i, j, k, l
479-
real(wp) :: loc_violations = 0._wp, glb_violations
479+
real(wp) :: loc_violations, glb_violations
480480

481481
! Downsample variables
482482
integer :: m_ds, n_ds, p_ds
483483
integer :: m_glb_ds, n_glb_ds, p_glb_ds
484484
integer :: m_glb_save, n_glb_save, p_glb_save ! Size of array being saved
485485

486+
loc_violations = 0._wp
487+
486488
if (down_sample) then
487489
if ((mod(m + 1, 3) > 0) .or. (mod(n + 1, 3) > 0) .or. (mod(p + 1, 3) > 0)) then
488490
loc_violations = 1._wp

0 commit comments

Comments
 (0)