Silverfrost Forums

Welcome to our forums

Bug with host association and derived types

21 Jul 2011 6:13 #8603

I have encountered a strange bug with host association and derived types.

The following code illustrates the bug. When the six comment lines are uncommented, the [u:6eda2d8d96]first[/u:6eda2d8d96] call to add_one does not occur and an 'Access Violation' error is given in the debugger.

Note that the error occurs before the call to the contained subroutine bbb.

With the comments in place the call to add_one works.

Hopefully, this is a small enough sample to allow this to be debugged.

Best Regards David.

module foo
   type wrap_type
     integer :: n = 10
   end type wrap_type
contains
   subroutine add_one(w)
      type(wrap_type), intent(inout) :: w
      w%n = w%n + 1
   end subroutine add_one
end module foo


module routines
contains
   subroutine aaa(w)
      use foo
      type (wrap_type), intent(inout) :: w
      call add_one(w)  !< Access Violation occurs when following comments are removed.
     !call bbb
   !contains
   !   subroutine bbb
   !      call add_one(w)
   !   end subroutine bbb
   end subroutine aaa
end module routines


program check
   use foo
   use routines
   type (wrap_type) :: w
   call aaa(w)
end program check
22 Jul 2011 6:54 #8605

It looks to me like this bug has already been fixed for the next release. I cannot reproduce it and I have fixed a similar bug recently.

22 Jul 2011 5:02 #8612

Thanks Paul.

I am using verion 6.1, so if you have a later, development version and the above works then you must have fixed it already. 😄

Please login to reply.