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

Wrong constructor for extended type

Daniel_Dopico
New Contributor I
906 Views

The code below gives the following error: "error #6593: The number of expressions in a structure constructor differs from the number of components of the derived type.   [TYPERESTRIC_UNITVECT]", but according to me the code should be correct.

PROGRAM wrong_constructor
    IMPLICIT NONE

    TYPE VECTOR
	    REAL(8),POINTER,DIMENSION(:)::rpt=>null(),rptp=>null(),rpts=>null()
    END TYPE VECTOR

    TYPE,ABSTRACT::typerestric
        INTEGER:: ir = -1
        INTEGER numrestrics
	    REAL(8)::penaltycoef_rel=1.d0
    END TYPE typerestric

    TYPE,EXTENDS(typerestric)::typerestric_unitvect
        TYPE(VECTOR),POINTER:: u
    END TYPE typerestric_unitvect

    TYPE(VECTOR),TARGET::u
    TYPE(typerestric_unitvect) RS
    
    RS=typerestric_unitvect(ir=1,numrestrics=1,penaltycoef_rel=1.d0,u=u)
    
END PROGRAM wrong_constructor

 

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
906 Views

The compiler seems to get confused by the two uses of "u" in the constructor. If I rename the variable to "u2" it works.  Please submit this in a bug report to Intel.

View solution in original post

0 Kudos
6 Replies
Steve_Lionel
Honored Contributor III
907 Views

The compiler seems to get confused by the two uses of "u" in the constructor. If I rename the variable to "u2" it works.  Please submit this in a bug report to Intel.

0 Kudos
Daniel_Dopico
New Contributor I
906 Views

Thank you very much, Steve, I didn't notice this. Moreover, it happens only with extended types, if all the variables are defined in the type without extension, the bug dissapears too.

0 Kudos
Daniel_Dopico
New Contributor I
906 Views

Steve Lionel (Ret.) (Blackbelt) wrote:

The compiler seems to get confused by the two uses of "u" in the constructor. If I rename the variable to "u2" it works.  Please submit this in a bug report to Intel.

Done.

0 Kudos
Devorah_H_Intel
Moderator
906 Views

Thank you for your report. I have escalated this issue to our compiler engineering.

0 Kudos
Daniel_Dopico
New Contributor I
906 Views

Thank you Devorah.

0 Kudos
Ron_Green
Moderator
880 Views

this issue was fixed in PSXE 2020 Update 2, compilers 19.1.2


0 Kudos
Reply