Skip to content

Commit 0228a3e

Browse files
committed
insert_at: gcc-15 fix
1 parent a12c961 commit 0228a3e

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

test/stringlist/test_insert_at.f90

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -204,42 +204,41 @@ subroutine test_insert_at_array
204204
integer, parameter :: first = -100
205205
integer, parameter :: last = 100
206206
integer, parameter :: stride = 4
207+
type(string_type) :: all_strings(first:last)
207208

208209
write (*,*) "test_insert_at_array: Starting work_list!"
210+
211+
do concurrent (j=first:last)
212+
all_strings(j) = string_type( to_string(j) )
213+
end do
209214

210-
call work_list%insert_at( list_head, &
211-
& [ ( string_type( to_string(j) ), j = first, first + stride - 1 ) ] )
215+
call work_list%insert_at( list_head, all_strings(first:first+stride-1) )
212216

213217
call compare_list( work_list, first, first + stride, 5 )
214218

215-
call work_list%insert_at( list_tail, &
216-
& [ ( string_type( to_string(j) ), j = last - stride, last - 1 ) ] )
219+
call work_list%insert_at( list_tail, all_strings(last-stride:last-1) )
217220

218221
do i = first + stride, last - stride - 1, stride
219-
call work_list%insert_at( fidx( i - first + 1 ), &
220-
& [ ( string_type( to_string(j) ), j = i, i + stride - 1 ) ] )
222+
call work_list%insert_at( fidx( i - first + 1 ), all_strings(i:i+stride-1) )
221223
end do
222224

223-
call work_list%insert_at( list_tail, [ to_string(last) ] )
225+
call work_list%insert_at( list_tail, all_strings(last:last) )
224226

225227
call compare_list( work_list, first, last + 1, 6 )
226228

227229
write (*,*) "test_insert_at_array: Starting reference_list!"
228230

229-
call reference_list%insert_at( list_tail, &
230-
& [ ( string_type( to_string(j) ), j = last - stride + 1, last ) ] )
231+
call reference_list%insert_at( list_tail, all_strings (last-stride+1:last) )
231232

232233
call compare_list( reference_list, last - stride + 1, last + 1, 7 )
233234

234-
call reference_list%insert_at( list_head, &
235-
& [ ( string_type( to_string(j) ), j = first + 1, first + stride ) ] )
235+
call reference_list%insert_at( list_head, all_strings(first+1:first+stride) )
236236

237237
do i = last - stride, first + stride + 1, -1 * stride
238-
call reference_list%insert_at( bidx( last - i + 1 ), &
239-
& [ ( string_type( to_string(j) ), j = i - stride + 1, i ) ] )
238+
call reference_list%insert_at( bidx( last - i + 1 ), all_strings(i-stride+1:i) )
240239
end do
241240

242-
call reference_list%insert_at( list_head, [ to_string(first) ] )
241+
call reference_list%insert_at( list_head, all_strings(first:first) )
243242

244243
call compare_list( reference_list, first, last + 1, 8 )
245244

@@ -252,20 +251,25 @@ subroutine test_insert_at_list
252251
integer, parameter :: first = -100
253252
integer, parameter :: last = 100
254253
integer, parameter :: stride = 4
254+
type(string_type) :: all_strings(first:last)
255255

256256
write (*,*) "test_insert_at_list: Starting work_list!"
257+
258+
do concurrent (j=first:last)
259+
all_strings(j) = string_type( to_string(j) )
260+
end do
257261

258262
call temp_list%clear()
259263
do j = first, first + stride - 1
260-
call temp_list%insert_at( list_tail, string_type( to_string(j) ) )
264+
call temp_list%insert_at( list_tail, all_strings(j) )
261265
end do
262266

263267
call work_list%insert_at(list_head, temp_list)
264268
call compare_list( work_list, first, first + stride, 9)
265269

266270
call temp_list%clear()
267271
do j = last - 1, last - stride, -1
268-
call temp_list%insert_at( list_head, string_type( to_string(j) ) )
272+
call temp_list%insert_at( list_head, all_strings(j) )
269273
end do
270274

271275
call work_list%insert_at(list_tail, temp_list)
@@ -280,7 +284,7 @@ subroutine test_insert_at_list
280284
end do
281285

282286
call temp_list%clear()
283-
call temp_list%insert_at( list_head, to_string(last) )
287+
call temp_list%insert_at( list_head, all_strings(last) )
284288
call work_list%insert_at( list_tail, temp_list )
285289

286290
call compare_list( work_list, first, last + 1, 10 )

0 commit comments

Comments
 (0)