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

Impossible to associate pointer to array from submodule.

Daniel_Dopico
New Contributor I
376 Views

1>D:\temp\Fallo_compilador3\restricciones.f90(27): error #7994: A use associated object that has the PROTECTED attribute shall not appear as a target in a pointer-assignment-stmt.   [FI]

The mentioned error is obtained with the following piece of code in Intel Parallel Studio XE 2018 Update 2. I also include the code and the compilation results attached. Observe that it is possible to point from the module, but it is not possible from the submodule.

!C************************************************************
MODULE parent_module
IMPLICIT NONE
   
!> Private, public and public protected variables
REAL(8),DIMENSION(5),PROTECTED,TARGET::fi
REAL(8),POINTER,DIMENSION(:),PRIVATE::pfisub=>null(),pfimod=>null()
!> Submodule subroutine interface
INTERFACE
    MODULE SUBROUTINE modifSub
    END SUBROUTINE modifSub
END INTERFACE
CONTAINS
SUBROUTINE modif
    pfimod=>fi(1:3)
END SUBROUTINE modif
END MODULE parent_module
!C************************************************************
!C************************************************************
SUBMODULE (parent_module) submod1
IMPLICIT NONE
CONTAINS
MODULE SUBROUTINE modifSub
    pfisub=>fi(1:3)
END SUBROUTINE modifSub
END SUBMODULE submod1
!C************************************************************
0 Kudos
2 Replies
FortranFan
Honored Contributor II
376 Views

Looks like a compiler bug, submit at OSC.  It's yet another in connection with SUBMODULEs and entities of PROTECTED attribute with HOST association.

Intel fixed the 2 cases (one of which was yours) but their feature validation test suite likely has a gap when it comes to POINTER attribute:

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/747601

https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/610969

https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/713413

Hope Intel team is reading this and will do more than treat this as a bug report, rather do a review of their validation cases and look to catch issues before customers encounter them.

0 Kudos
Daniel_Dopico
New Contributor I
376 Views

Thank you fan.

It seems that, at least concerning submodules, Intel Fortran is far from supporting them properly.

This is a bit discouraging because the Fortran standard is quite clear about the rules.

0 Kudos
Reply