Community
cancel
Showing results for 
Search instead for 
Did you mean: 
lauhwa
Beginner
85 Views

error6122, pointer function in submodule

Jump to solution

Recently I try to use submodule. But My compiler return a error of code 6122. There is a module and its sub module.

  module nonuni
  implicit none

  interface
  module function get_subarray(a,i,j)
  implicit none
  real,target::a(:)
  integer::i,j
  real,pointer::get_subarray(:)

  endfunction
  end interface

  endmodule

  submodule(nonuni) nonunis
  implicit none
  contains
  module function get_subarray(a,i,j)
  implicit none
  real,target::a(:)
  integer::i,j
  real,pointer::get_subarray(:)

  get_subarray=>a(i:j)
  endfunction
  end submodule
  
  submodule(nonuni) nonunis
  implicit none 
  contains 
    module function get_subarray(a,i,j)
  implicit none 
  real,target::a(:)
  integer::i,j
  real,pointer::get_subarray(:)
  
  get_subarray=>a(i:j)
  endfunction 
  end submodule 
 
Then the compiler returned
error #6122: The characteristics of the separate module procedure differ from those specified in the separate interface body. [GET_SUBARRAY].
 
Then I tried another form.
  module nonuni
  implicit none

  interface
  module function get_subarray(a,i,jresult(asub)
  implicit none
  real,target::a(:)
  integer::i,j
  real,pointer::asub(:)

  endfunction
  end interface

  endmodule

  submodule(nonuni) nonunis
  implicit none
  contains
  module function get_subarray(a,i,jresult(asub)
  implicit none
  real,target::a(:)
  integer::i,j
  real,pointer::asub(:)

  asub=>a(i:j)
  endfunction
  end submodule
 
It was compiled successfully.
  

 

0 Kudos

Accepted Solutions
Arjen_Markus
Valued Contributor III
67 Views

This looks like a bug in the Intel Fortran compiler. gfortran 10.2.0 accepts the code and I see no difference between the interface in the module and the actual code in the submodule.

View solution in original post

2 Replies
Arjen_Markus
Valued Contributor III
68 Views

This looks like a bug in the Intel Fortran compiler. gfortran 10.2.0 accepts the code and I see no difference between the interface in the module and the actual code in the submodule.

View solution in original post

Barbara_P_Intel
Moderator
41 Views

I filed a bug report on this, CMPLRLLVM-25800. I'll post here when there's a fix.