Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Subroutine memory problem

jaeger0
Beginner
891 Views
I think I have a memory Problem. I have the folloving subroutines

subroutine UniPtr2UniType(ptr,prop)
implicit none
! input variables
type(ULitem),pointer :: ptr ! patient pointer
type(UniType) prop ! patient type (strings)
.
.
end subroutine

subroutine Test
implicit none
type(ULitem),pointer :: ptr ! patient pointer
type(UniType) prop

call UniPtr2UniType(ptr,prop)
.
.

end subroutine

when I'm debugging, and at position call UnitPtr2UniType, the pointer ptr is defined.
Stepping into the subroutine, the pointer is not more defined, and the program hangs up if I use the ptr-pointer

I used the same subroutines in an other programm and there all worked, but in the current (a large project) It does not work. I think that's a memory problem, but how can I solve that ?
0 Kudos
1 Solution
Steven_L_Intel1
Employee
891 Views

Is an explicit interface to UniPtr2UniT visible to the caller? That's required. Put a PRINT (or similar) of the value inside the subroutine - does it give the proper value? A "hang" is not usually a "memory problem".

I'll repeat a past observation - when someone posts a few sample lines from a program and says he thinks this is where the problem is, he is usually mistaken. Try to construct a small but complete test case - in many times this will lead you to the solution.

View solution in original post

0 Kudos
3 Replies
Steven_L_Intel1
Employee
892 Views

Is an explicit interface to UniPtr2UniT visible to the caller? That's required. Put a PRINT (or similar) of the value inside the subroutine - does it give the proper value? A "hang" is not usually a "memory problem".

I'll repeat a past observation - when someone posts a few sample lines from a program and says he thinks this is where the problem is, he is usually mistaken. Try to construct a small but complete test case - in many times this will lead you to the solution.
0 Kudos
jaeger0
Beginner
891 Views

Is an explicit interface to UniPtr2UniT visible to the caller? That's required. Put a PRINT (or similar) of the value inside the subroutine - does it give the proper value? A "hang" is not usually a "memory problem".

I'll repeat a past observation - when someone posts a few sample lines from a program and says he thinks this is where the problem is, he is usually mistaken. Try to construct a small but complete test case - in many times this will lead you to the solution.

The problem was, that there was no explicit interface visible. I did not know that I have to do that. I packed all subroutines (UniPtr2UniT,.. ) into a module, so it worked without explicit interface definition for the caller.

Thanks
Steve
0 Kudos
Steven_L_Intel1
Employee
891 Views

Putting the routines in a module and USEing the module provides the explicit interface. That is a fine way to handle it. If you had built with generated interface checking enabled, the compiler probably would have warned you about this.

See also Doctor Fortran Gets Explicit.
0 Kudos
Reply