I am trying to use merge_sort function that is contained in module-1 within module-2. No matter where I place the USE module-1 statement within module-2, I get compiler errors. Either error #6285: There is no matching specific subroutine for this generic subroutine call. Or catastrophic error: **Internal compiler error: segmentation violation signal raised**. Obviously I am missing something in my understanding of modules.
The basic set up is that module-1 is a merge sort module that sorts int64 arrays or arrays of objects of class face. The second module is the face class and in its constructor I would like to call the int64 merge sort.
Here is a stripped down version of the merge sort module and the face module. Error #6285 is thrown by the compiler when I place "use mergesort_class" at the top of module face_class; i.e. between lines 01 and 02. The catastropic error is thrown by the compiler when instead I place the use mergesort_class at the top of function make_face; i.e. between lines 23 and 24. See below the code snippets for the actual error messages.
I am relatively new to trying to use modules/classes in Fortran, so I am a bit shaky on the internal workings, despite lots of reading. Any and all help will be greatly appreciated.
-sanjay
module mergesort_class ! Source file mergesort_class implicit none private public :: mergesort interface mergesort module procedure ms_int64, ms_face end interface contains subroutine ms_int64(array,n,idx) implicit none integer :: n integer :: idx(*) integer (kind=8) :: array(*) ! relevant code to merge int64 end subroutine ms_int64 subroutine mergea_int64(array,l,m,r,idx) implicit none integer :: l,m,r integer :: idx(*) integer (kind=8) :: array(*) ! relevant code to merge int64 end subroutine mergea_int64 subroutine ms_face(array,n,idx) use face_class implicit none integer :: n integer :: idx(*) type(face) :: array(*) ! relevant code to merge face objects end subroutine ms_face subroutine mergea_face(array,l,m,r,idx) use face_class implicit none integer :: l,m,r integer :: idx(*) type(face) :: array(*) ! relevant code to merge face objects end subroutine mergea_face end module mergesort_class
module face_class ! Source file face_class.f implicit none private public :: face ! Type def for face type face integer (kind=8) :: hi,lo contains procedure :: face_equal procedure :: face_le generic, public :: operator (.eq.) => face_equal generic, public :: operator (.le.) => face_le end type face interface face module procedure make_face end interface face contains ! Constructor type(face) function make_face(a,b,c,d) implicit none integer, intent(in) :: a,b,c integer, optional, intent(in) :: d integer (kind=8) :: n(4),m(4) ! relevant code to set up n( ) and m( ) call mergesort(n,4,m) ! Can not get this call to work end function make_face ! overloaded .eq. logical function face_equal(a,b) implicit none class(face), intent(in) :: a,b ! relevant code end function face_equal ! overloaded .le. logical function face_le(a,b) implicit none class(face), intent(in) :: a,b ! relevant code end function face_le end module face_class
ifort -c -O2 -Warn all -g -J/Users/sg/Feap/ver85/modules -I/Users/sg/Feap/ver85/include -I/Users/sg/Feap/ver85/modules -I/Users/sg/Feap/ver85/include/integer8 -I/sw/include face_class.f -o face_class.o
face_class.f(57): error #6285: There is no matching specific subroutine for this generic subroutine call. [MERGESORT]
call mergesort(n,4,m)
---------------^
compilation aborted for face_class.f (code 1)
make: *** [face_class.o] Error 1
ifort -c -O2 -Warn all -g -J/Users/sg/Feap/ver85/modules -I/Users/sg/Feap/ver85/include -I/Users/sg/Feap/ver85/modules -I/Users/sg/Feap/ver85/include/integer8 -I/sw/include face_class.f -o face_class.o
face_class.f: catastrophic error: **Internal compiler error: segmentation violation signal raised** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
compilation aborted for face_class.f (code 1)
make: *** [face_class.o] Error 1