Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26747 Discussions

Internal compiler error for module function with pointer return

Andrew_Smith
New Contributor III
127 Views

This code re-produces:

module A
   implicit none
   interface
      pure real module function getItem(id) result(res)
         integer, intent(in) :: id
         pointer :: res
      end
   end interface
   real, target :: items(10)
end module

submodule(A) A1
   implicit none
contains
   pure real module function getItem(id) result(res)
      integer, intent(in) :: id
      pointer :: res
      res => items(id)
   end
end submodule

 

0 Kudos
4 Replies
andrew_4619
Honored Contributor I
127 Views

But

module A
   implicit none
   interface
       pure module function getItem(id)  
         integer, intent(in) :: id
         real, pointer :: getItem
      end function getItem
   end interface
   real, target :: items(10)
end module
submodule(A) A1
   implicit none
   contains
   module procedure getItem 
        getItem => items(id)
   end procedure getItem
end submodule

this form does not have an ICE or Compile errors.... I do not like to use this form BTW

Kevin_D_Intel
Employee
127 Views

Thank you for reporting this and for the convenient reproducer. It reproduces with current (17.0) and previous (16.0) compilers. I reported it to Development.

(Internal tracking id: DPD200418366)

FortranFan
Honored Contributor II
127 Views

Kevin,

Please note also the "module procedure" variant by Andrew in Message #2 should throw a compiler error about the invalid pointer assignment in a PURE procedure.  Intel Fortran compiler misses out on it, can you please investigate and followup as needed?

Thanks much,

 

Kevin_D_Intel
Employee
127 Views

Thank you FortranFan. I submitted that one also. I was wondering about that earlier in regard to the original case too.

(Internal tracking id: DPD200418373 - Missing error for invalid pointer assignment in a PURE procedure)

Reply