From 47fcdb32eab75741ea7fda485c72ebd9f7dedee1 Mon Sep 17 00:00:00 2001 From: Federico Perini Date: Sun, 25 Feb 2024 20:02:59 +0100 Subject: [PATCH] resize dependency array after build --- src/fpm/dependency.f90 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/fpm/dependency.f90 b/src/fpm/dependency.f90 index 71bc74514f..ee048e2df9 100644 --- a/src/fpm/dependency.f90 +++ b/src/fpm/dependency.f90 @@ -406,6 +406,9 @@ recursive subroutine add_project_dependencies(self, package, root, main, error) end if end if + !> Ensure allocation fits + call resize(self%dep,self%ndep) + end subroutine add_project_dependencies !> Add a list of dependencies to the dependency tree @@ -430,6 +433,9 @@ subroutine add_dependencies(self, dependency, error) end do if (allocated(error)) return + !> Ensure allocation fits ndep + call resize(self%dep,self%ndep) + end subroutine add_dependencies !> Add a single dependency node to the dependency tree @@ -464,6 +470,10 @@ subroutine add_dependency_node(self, dependency, error) end if end if else + + !> Safety: reallocate if necessary + if (size(self%dep)==self%ndep) call resize(self%dep,self%ndep+1) + ! New dependency: add from scratch self%ndep = self%ndep + 1 self%dep(self%ndep) = dependency