Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Error #6633 for dervied types

mountain_ike1
Beginner
644 Views
Below is the code I am useing (MUCH simplified from my original), but it will not compile, giving me the dreaded error #6633. Does anyone have any idea what I am doing wrong? I am building a windows program from VS2008 using intel fortrna 11...

program typetest

type griddata
integer nx,ny
real dx,dy,x0,y0
end type griddata

type(griddata) :: alt

call elsize(alt)
end program


subroutine elsize(alt)

type griddata
integer nx,ny
real dx,dy,x0,y0
end type griddata

type (griddata) :: alt

end

Bruce
0 Kudos
6 Replies
DavidWhite
Valued Contributor II
644 Views
Suggest you put the type declaration in a module:

module mytypes

type griddata

integer nx,ny

real dx,dy,x0,y0

end type griddata

end module mytypes

program typetest

use mytypes

type(griddata) :: alt

call elsize(alt)

end program

subroutine elsize(alt)

use mytypes

type (griddata) :: alt

end

0 Kudos
Robert_van_Amerongen
New Contributor III
644 Views

Bruce,

of course as seen from the point of elegancy, the remarks of David areto the point.Nevertheless the code seems correct Fortranand thus must compile correct. I presume that the automatic interface creating causesthe problem here; if you add /warn:nointerfaces then everything wents fine!

I did not have taken a look at the generated interface.

Robert

0 Kudos
mecej4
Honored Contributor III
644 Views
While we may dispute the logic behind the rules of the language, the compiler is simply telling you that your code is in violation of the standard. Here is the relevant quotation from Metcalf, Reid and Cohen, Fortran 95/2003 Simplified, OUP, 2004:

...even if two derived-type definitions are identical in every respect except their names, entities of these two types are not equivalent. Even if the names, too, are identical, the types are different (unless...).

I guess that the reason for this counter-intuitive rule is to give the compiler leeway to produce different memory layouts of such variables in different contexts, possibly increasing efficiency by some measure.

Put the type definition in a module and USE the module wherever you need the type, as David White already suggested.
0 Kudos
Robert_van_Amerongen
New Contributor III
644 Views
mecej4 is quit right! This issue has been raises earlier (see thread August 1) but this forum member hasforgotten that he was the one who started the thread (sic!!)

So, Bruce, definethe type in a module and everyting is oke.

Of course, the question remains why the compiler will not give an error or warning, irrespective the setting of /warn.

Robert
0 Kudos
Steven_L_Intel1
Employee
644 Views
But the thread was started because the compiler DID give an error.
0 Kudos
mountain_ike1
Beginner
644 Views
Thanks everyone. Using the module to store my derived types solved my problem, and now my code is that much more sleek!
0 Kudos
Reply