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

Parameterized derived type kind declaration order

DataScientist
Valued Contributor I
195 Views

This Fortran code snippet compiles with gfortran, but not with Intel because the Intel Fortran compiler wants the kind declarations to be the first in the type block. Which behavior is standard-conforming?

 

 

program pdt_kind_order
    type :: pdt_type(ikind, rkind)
        integer         :: np
        integer , kind  :: ikind
        integer , kind  :: rkind
    end type pdt_type
end

 

 

Here are the error messages:

 

pdt_kind_order.f90(2): error #8723: This type parameter name has not been defined.   [IKIND]
type :: pdt_type(ikind, rkind)
---------------------^                                                                                                                                                                                                                                       pdt_kind_order.f90(2): error #8723: This type parameter name has not been defined.   [RKIND]
type :: pdt_type(ikind, rkind)
----------------------------^                                                                                                                                                                                                                                compilation aborted for pdt_kind_order.f90 (code 1)

 

0 Kudos
1 Solution
Steve_Lionel
Black Belt Retired Employee
179 Views

gfortran has an extension - the standard (F2018 R726) says that type-param-def-stmts must appear first, then private-or-sequence, and then components. If gfortran doesn't complain about this when you ask for standards checking, it's a bug.

View solution in original post

1 Reply
Steve_Lionel
Black Belt Retired Employee
180 Views

gfortran has an extension - the standard (F2018 R726) says that type-param-def-stmts must appear first, then private-or-sequence, and then components. If gfortran doesn't complain about this when you ask for standards checking, it's a bug.

Reply