Skip to content

Commit a491510

Browse files
committed
Extract arr_size to satisfy Intel
1 parent dc8e01f commit a491510

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/stdlib_io_np_save.fypp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ contains
149149
!> Error message.
150150
character(len=:), allocatable, intent(out), optional :: msg
151151

152-
integer :: i
152+
integer :: i, arr_size
153153
type(t_array_${t1[0]}$${k1}$_${rank}$) :: t_arr
154154

155155
if (present(stat)) stat = 0
@@ -169,16 +169,18 @@ contains
169169
return
170170
end if
171171

172-
do i = 1, size(arrays)
172+
arr_size = size(arrays)
173+
do i = 1, arr_size
173174
if (arrays(i)%array%name == name) then
174175
if (present(stat)) stat = 1
175176
if (present(msg)) msg = "Array with the same name '"//name//"' already exists."
176177
return
177178
end if
178179
end do
179180

180-
allocate(arrays(size(arrays) + 1))
181-
arrays(size(arrays))%array = t_arr
181+
arr_size = arr_size + 1
182+
allocate(arrays(arr_size))
183+
arrays(arr_size)%array = t_arr
182184
end
183185
#:endfor
184186
#:endfor

0 commit comments

Comments
 (0)