PARAMETER initialization fails when TYPE builds on an ABSTRACT class

PARAMETER initialization fails when TYPE builds on an ABSTRACT class

In my code I have some PARAMETERs of a derived type which builds on an ABSTRACT type/class with no components:

TYPE, ABSTRACT :: point
CONTAINS PROCEDURE :: dist => pt_to_pt_dist
END TYPE point

TYPE, EXTENDS(point) :: point2d
REAL, DIMENSION(2) :: c !coordinates: c(1) & c(2)
CONTAINS
PROCEDURE :: array_to_point2d
GENERIC :: ASSIGNMENT(=) => array_to_point2d
END TYPE point2d

The below declaration statement compiles without problems:
TYPE(point2d),PARAMETER :: apoint=point2d([ 2.0, 3.0 ])
However, if I then print the array apoint%c the actual values don't seem to be initialized at all, and seemingly random numbers are printed, as if it was an ordinary variable that wasn't initialized yet.
If I then change the point2d type to a 'stand-alone' type, ie. I remove the EXTENDS(point) attribute, everything works just fine.
I'm testing the IVF 2013 compiler right now, but I get the same strange behavior using the 2011 compiler.
Is it a compiler bug, or am I doing something wrong?

And I also want to ask if parameterized derived types are far away

4 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

I'll take a look at your example tomorrow, but don't look for parameterized derived types anytime soon. I expect this will be the last 2003 feature we do.

Steve - Intel Developer Support

I have reproduced this and escalated it to the developers as issue DPD200238645. I will update this thread with any news. Thanks for taking the time to let us know of the problem.

Steve - Intel Developer Support

This has been fixed for a release later this year.

Steve - Intel Developer Support

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!