Skip to content

Commit 1f09e9e

Browse files
committed
linalg-norm: gcc-15 test fix
1 parent 1ab94a7 commit 1f09e9e

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

test/linalg/test_linalg_norm.fypp

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ module test_linalg_norm
3232
allocate(tests(0))
3333

3434
#:for rk,rt,ri in RC_KINDS_TYPES
35-
tests = [tests,new_unittest("strided_1d_norm_${ri}$",test_strided_1d_${ri}$)]
35+
call add_test(tests,new_unittest("strided_1d_norm_${ri}$",test_strided_1d_${ri}$))
3636
#:for rank in range(1, MAXRANK)
37-
tests = [tests,new_unittest("norm_${ri}$_${rank}$d",test_norm_${ri}$_${rank}$d)]
37+
call add_test(tests,new_unittest("norm_${ri}$_${rank}$d",test_norm_${ri}$_${rank}$d))
3838
#:endfor
3939
#:for rank in range(2, MAXRANK)
4040
#:if rt.startswith('real')
41-
tests = [tests,new_unittest("norm2_${ri}$_${rank}$d",test_norm2_${ri}$_${rank}$d)]
41+
call add_test(tests,new_unittest("norm2_${ri}$_${rank}$d",test_norm2_${ri}$_${rank}$d))
4242
#:endif
43-
tests = [tests,new_unittest("maxabs_${ri}$_${rank}$d",test_maxabs_${ri}$_${rank}$d)]
44-
tests = [tests,new_unittest("norm_dimmed_${ri}$_${rank}$d",test_norm_dimmed_${ri}$_${rank}$d)]
43+
call add_test(tests,new_unittest("maxabs_${ri}$_${rank}$d",test_maxabs_${ri}$_${rank}$d))
44+
call add_test(tests,new_unittest("norm_dimmed_${ri}$_${rank}$d",test_norm_dimmed_${ri}$_${rank}$d))
4545
#:endfor
4646
#:endfor
4747

@@ -268,6 +268,26 @@ module test_linalg_norm
268268
#:endfor
269269
#:endfor
270270

271+
! gcc-15 bugfix utility
272+
pure subroutine add_test(tests,new_test)
273+
type(unittest_type), allocatable, intent(inout) :: tests(:)
274+
type(unittest_type), intent(in) :: new_test
275+
276+
integer :: n
277+
type(unittest_type), allocatable :: new_tests(:)
278+
279+
if (allocated(tests)) then
280+
n = size(tests)
281+
else
282+
n = 0
283+
end if
284+
285+
allocate(new_tests(n+1))
286+
if (n>0) new_tests(1:n) = tests(1:n)
287+
new_tests(1+n) = new_test
288+
call move_alloc(from=new_tests,to=tests)
289+
290+
end subroutine add_test
271291

272292
end module test_linalg_norm
273293

0 commit comments

Comments
 (0)