Add one compile command to array with a loop (gcc-15 bug on array initializer)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(compile_command_t), | intent(inout), | allocatable | :: | list(:) | ||
| type(compile_command_t), | intent(in) | :: | new |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | i | ||||
| integer, | public | :: | n | ||||
| type(compile_command_t), | public, | allocatable | :: | tmp(:) |
pure subroutine add_compile_command_one(list,new) type(compile_command_t), allocatable, intent(inout) :: list(:) type(compile_command_t), intent(in) :: new integer :: i,n type(compile_command_t), allocatable :: tmp(:) if (allocated(list)) then n = size(list) else n = 0 end if allocate(tmp(n+1)) do i=1,n tmp(i) = list(i) end do tmp(n+1) = new call move_alloc(from=tmp,to=list) end subroutine add_compile_command_one