Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

error6122, pointer function in submodule

lauhwa
Novice
1,624 Views

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
1 Solution
Barbara_P_Intel
Employee
1,474 Views

The bug described in this thread is fixed in the latest compiler release, 2021.3.0. I just tried it.

Please download it and confirm.  Let me know what you find.

View solution in original post

0 Kudos
3 Replies
Arjen_Markus
Honored Contributor II
1,606 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.

0 Kudos
Barbara_P_Intel
Employee
1,580 Views

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

0 Kudos
Barbara_P_Intel
Employee
1,475 Views

The bug described in this thread is fixed in the latest compiler release, 2021.3.0. I just tried it.

Please download it and confirm.  Let me know what you find.

0 Kudos
Reply