Skip to content

Commit 0077952

Browse files
committed
fix tests on index array
1 parent cdfa62c commit 0077952

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/stdlib_sorting_sort_index.fypp

+6-6
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,18 @@ contains
106106
${t2}$, allocatable :: buf(:)
107107
${ti}$, allocatable :: ibuf(:)
108108

109-
if ( size(array, kind=int_index) > huge(1_${ki}$) then
109+
array_size = size(array, kind=int_index)
110+
111+
if ( array_size > huge(index)) then
110112
error stop "Too many entries for the kind of index."
111113
end if
112114

113-
array_size = size(array, kind=int_index)
114-
115-
if ( size(index, kind=int_index) < array_size ) then
116-
error stop "index array is too small."
115+
if ( array_size > size(index, kind=int_index) ) then
116+
error stop "Too many entries for the size of index."
117117
end if
118118

119119
do i = 0, array_size-1
120-
index(i) = i+1
120+
index(i) = int(i+1, kind=${ki}$)
121121
end do
122122

123123
if ( optval(reverse, .false.) ) then

0 commit comments

Comments
 (0)