remove_from_stack Subroutine

private subroutine remove_from_stack(idx)

Remove a region index from the stack (helper for explicit stop)

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: idx

Called by

proc~~remove_from_stack~~CalledByGraph proc~remove_from_stack remove_from_stack proc~profiler_stop profiler_stop proc~profiler_stop->proc~remove_from_stack

Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), private :: i
integer(kind=default_int), private :: j

Source Code

   subroutine remove_from_stack(idx)
      !! Remove a region index from the stack (helper for explicit stop)
      integer(default_int), intent(in) :: idx
      integer(default_int) :: i, j

      do i = state%stack_depth, 1, -1
         if (state%stack(i) == idx) then
            ! Shift remaining elements down
            do j = i, state%stack_depth - 1
               state%stack(j) = state%stack(j + 1)
            end do
            state%stack_depth = state%stack_depth - 1
            return
         end if
      end do
   end subroutine remove_from_stack