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

Bug in ifort 19: Submodules cannot access entities from module scope if using private statement

New Contributor I

Here is a bug introduced in ifort version

Module Item_Class
  implicit none
  Type ::  Item_Type
  End Type
End Module

Module Container_Class
  use Item_Class ,only: Item_Type
  implicit none
    Module Subroutine Proc()
    End Subroutine
  End Interface
End Module

SubModule(Container_Class) Container_SubClass
  implicit none
  Module Procedure Proc
    type(Item_Type) :: Item
  End Procedure
End SubModule


This code compile fine using ifort 18 but with ifort 19 I got the following error message


Example_Module.F90(21): error #6457: This derived type name has not been declared.   [ITEM_TYPE]
    type(Item_Type) :: Item

which is obviously wrong.

The problem is that the entities (variables, procedures, derived-type) accessed through host association in the module scope are not passed to sub-modules if the module uses the private statement. My understanding is that this behavior is incorrect since all the entities in the module scope should be accessible from within the sub-modules independently of the private/public statement of the module.

Removing the "private" statement in the module scope of the "Container_Class" module fixes the problem.

I've submitted this to OSC.

0 Kudos
1 Reply

This issue is fixed in 19.0 Update 1 

0 Kudos