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
428 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
Black Belt Retired Employee
428 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

6 Replies
Steve_Lionel
Black Belt Retired Employee
429 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.

Daniel_Dopico
New Contributor I
428 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.

Daniel_Dopico
New Contributor I
428 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.

Devorah_H_Intel
Moderator
428 Views

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

Daniel_Dopico
New Contributor I
428 Views

Thank you Devorah.

Ron_Green
Moderator
402 Views

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


Reply