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

Compiler option for Type structure

Intel_C_Intel
Employee
321 Views

Using CVF6.6B


My question is about the sequence of compiling Type declarations

The following example module has two types, where the second type is depending on the first one.


module global1
TYPE ITEM
REAL COST
CHARACTER(LEN=30) SUPPLIER
CHARACTER(LEN=20) ITEM_NAME
END TYPE ITEM

TYPE PRODUCE
REAL MARKUP
TYPE(ITEM) FRUIT
END TYPE PRODUCE
end module global1

This compiles fine

Now when I change the sequence of the types in the following way


module global2
TYPE PRODUCE
REAL MARKUP
TYPE(ITEM) FRUIT
END TYPE PRODUCE

TYPE ITEM
REAL COST
CHARACTER(LEN=30) SUPPLIER
CHARACTER(LEN=20) ITEM_NAME
END TYPE ITEM
end module global2

then I get the following error message

Error: This derived type name has not been declared. [ITEM]
TYPE(ITEM) FRUIT
-----------^

This is because the Type ITEM is compiled after it is needed for the Type Produce

Is the a possibility (compiler option) to compile the second module without changing the sequence ???

The problem is, I have a source code with lots of Type declarations and they are all in the wrong order.

Thanks for any help
0 Kudos
1 Reply
Steven_L_Intel1
Employee
321 Views
No such option - you'll have to correct the code.

Steve
0 Kudos
Reply