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

Problem with sub sub submodules

Nicholas_B_
Beginner
396 Views

There seems to be a problem with sub sub submodules in Intel Fortran 17.0.1 (example code attached):

ifort -c mtop.f90
ifort -c submod.f90
ifort -c subsubmod.f90
ifort -c subsubsubmod.f90
subsubsubmod.f90(1): error #5082: Syntax error, found ':' when expecting one of: )
submodule (mtop:submod:subsubmod) subsubsubmod
----------------------^
subsubsubmod.f90(5): error #6116: A separate module procedure must only be defined in a module or a submodule.   [SUB3]
module subroutine sub3
------------------^
compilation aborted for subsubsubmod.f90 (code 1)
bash-4.1$ ifort -v
ifort version 17.0.1

gfortran 6.2.1 seems to be OK:

gfortran -c mtop.f90
gfortran -c submod.f90
gfortran -c subsubmod.f90
gfortran -c subsubsubmod.f90
gfortran --version
GNU Fortran (GCC) 6.2.1 20160916 (Red Hat 6.2.1-3)
 


 

 

 

0 Kudos
2 Replies
Steven_L_Intel1
Employee
396 Views

Intel Fortran is correct, gfortran is wrong is not rejecting the source. Your syntax is incorrect.

The syntax is:

R1117 submodule-stmt is SUBMODULE ( parent-identifier ) submodule-name
R1118 parent-identifier is ancestor-module-name [ : parent-submodule-name ]

You don't give the whole tree, just one of the parent's descendants. The correct line would be:

submodule (mtop:subsubmod) subsubsubmod

 

0 Kudos
Nicholas_B_
Beginner
396 Views

Steve

Thanks for your help.

Nick

0 Kudos
Reply