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

order of derived type definitions

raov
Beginner
382 Views
The code below compiles with ifort8, Lahey/Fujitsu, and Absoft,but not ifort9,
the latter saying
str_type_bug.f90(5) : Error: This name does not have a type, and must have an explicit type. [TT]
type(ap), pointer :: tt(:)
------------------------------^
ifort9 compiles it if the derived type ap is defined
before au or if in function foo, 'value' is declared
as in the commented-out line
I am using W_FC_P_9.0.018

module amod
implicit none
!
type :: au
type(ap), pointer :: tt(:)
end type au
!
type :: ap
real :: ss
end type ap
!
contains
!
function foo(xx) result(value)
type(au) , intent(in) :: xx
! real :: value(2)
real :: value(size(xx%tt))
value = 0.0
end function foo
end module amod
0 Kudos
3 Replies
Steven_L_Intel1
Employee
382 Views
Looks like a bug. Please report it to Intel Premier Support.
0 Kudos
Steven_L_Intel1
Employee
382 Views
Hmm - looks like a bug. With the pointer attribute, you're allowed to name a type defined later. Please report it to Intel Premier Support.
0 Kudos
Steven_L_Intel1
Employee
382 Views
This is an odd case. It is not strictly the order of declaration, as if you use the declaration value(2) in the subroutine instead of value(size(xx%tt)), it works. But you're right that reordering the declarations allows both cases to compile.

I think this is a bug and I'll report it to the developers. I'd encourage you to file a report to Intel Premier Support if you want to be notified of the fix.
0 Kudos
Reply