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

yet another bug(?) in parameterized derived types

may_ka
Beginner
493 Views

Hi all

I think this code should compile:

Module modparadt
  Type, public :: xx(k)
    Integer, kind :: k
    integer(k), allocatable :: v(:)
  End type xx
End Module modparadt
Program Test
  use modparadt
  Type(xx(8)), pointer :: yy=>null()
end Program Test

but when using ifort 17.07 and ifort 18.03 it stops with

tmp.f90(9): error #6197: An assignment of different structure types is invalid.   [YY]
  Type(xx(8)), pointer :: yy=>null()

any comments. If this is a bug I'll launch a ticket pointing to this theard.

cheers

0 Kudos
2 Replies
Juergen_R_R
Valued Contributor I
493 Views

Indeed, this compiles and runs with PGI 18.5, gfortran 9.0.0 (experimental) and nagfor 6.2 without any problems. 

0 Kudos
FortranFan
Honored Contributor II
493 Views

I too think it is a bug in Intel Fortran.  And it persists in 19.0 Beta Update 1 as well.

For whatever it's worth, the following change where the initialization of the object in the declaration is replaced with a separate pointer assignment instruction. Intel Fortran compiles the code ok:

  type(xx(k=8)), pointer :: yy
  yy => null()

 

0 Kudos
Reply