Add multiple compile commands 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 | :: | add | ||||
| integer, | public | :: | i | ||||
| integer, | public | :: | n | ||||
| type(compile_command_t), | public, | allocatable | :: | tmp(:) |
pure subroutine add_compile_command_many(list,new) type(compile_command_t), allocatable, intent(inout) :: list(:) type(compile_command_t), intent(in) :: new(:) integer :: i,n,add type(compile_command_t), allocatable :: tmp(:) if (allocated(list)) then n = size(list) else n = 0 end if add = size(new) if (add == 0) return allocate(tmp(n+add)) do i=1,n tmp(i) = list(i) end do do i=1,add tmp(n+i) = new(i) end do call move_alloc(from=tmp,to=list) end subroutine add_compile_command_many