Skip to content

Commit ded2c3c

Browse files
committed
Use proper allocates in add_array
1 parent bdbd9c9 commit ded2c3c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/stdlib_io_np_save.fypp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ contains
170170
end if
171171
end if
172172

173-
t_arr%values = array
173+
allocate(t_arr%values, source=array)
174174

175175
if (.not. allocated(arrays)) then
176176
allocate(arrays(1))
@@ -186,7 +186,7 @@ contains
186186
end if
187187
end do
188188

189-
wrapper%array = t_arr
189+
allocate(wrapper%array, source=t_arr)
190190
arrays = [arrays, wrapper]
191191
end
192192
#:endfor

test/io/test_np.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,7 @@ subroutine npz_save_two_arrays(error)
11501150
type(t_array_wrapper), allocatable :: arrays(:), arrays_reloaded(:)
11511151
integer :: stat, j
11521152
real(dp), allocatable :: input_array_1(:,:)
1153-
complex(dp), parameter, dimension(3) :: input_array_2 = [cmplx(1, 2, kind=8), cmplx(3, 4, kind=8), cmplx(5, 6, kind=8)]
1153+
complex(dp), parameter :: input_array_2(3) = [(1, 2._dp), (3, 4._dp), (5, 6._dp)]
11541154
character(*), parameter :: array_name_1 = "array_1"
11551155
character(*), parameter :: array_name_2 = "array_2"
11561156
character(*), parameter :: output_file = "two_arrays.npz"

0 commit comments

Comments
 (0)