Quantcast
Channel: Recent posts
Viewing all articles
Browse latest Browse all 27

Internal error when using a derived type decleared as a parameter

$
0
0

The following example generates an internal error. The internal error happens when I use a derived type that is declared as a parameter and in contains a generic binding. The offending statement is on line 76, while line 27 describes a work around.

I am using intel fortran 14.0.1 on openSUSE 12.3

MODULE HS2Kinds
USE ISO_FORTRAN_ENV, ONLY: INT32
USE ISO_FORTRAN_ENV, ONLY: REAL32, REAL64, REAL128
INTEGER, PARAMETER :: I4B = INT32
INTEGER, PARAMETER :: SP = REAL32
INTEGER, PARAMETER :: DP = REAL64
INTEGER, PARAMETER :: QP = REAL128
END MODULE HS2Kinds

MODULE HS2Frame
USE HS2Kinds
IMPLICIT NONE
PRIVATE
PUBLIC :: HSFrame, ITRF, ICRF
TYPE HSFrame
INTEGER(I4B), PRIVATE :: val = -1
CONTAINS
GENERIC :: toFrame => toFrameq, toFramed, toFrames
PROCEDURE, PASS :: toFrameq
PROCEDURE, PASS :: toFramed
PROCEDURE, PASS :: toFrames
END TYPE HSFrame

TYPE(HSFrame), PARAMETER :: ITRF = HSFrame(3)
TYPE(HSFrame), PARAMETER :: ICRF = HSFrame(12)

!ICE: No ICE with these two statements instead of those above.
!TYPE(HSFrame) :: ITRF = HSFrame(3)
!TYPE(HSFrame) :: ICRF = HSFrame(12)
CONTAINS
SUBROUTINE toFrameq(this, frm, r)
USE HS2Kinds, ONLY: XP => QP
CLASS(HSFrame), INTENT(IN) :: this, frm
REAL(XP), INTENT(INOUT) :: r(3)
! Dummy code
IF (this%val == 12 .AND. frm%val == 12) THEN
r = -1.0_XP
ELSE
r = REAL(frm%val, XP)
END IF
RETURN
END SUBROUTINE toFrameq

SUBROUTINE toFramed(this, frm, r)
USE HS2Kinds, ONLY: XP => DP
CLASS(HSFrame), INTENT(IN) :: this, frm
REAL(XP), INTENT(INOUT) :: r(3)
! Dummy code
IF (this%val == 12 .AND. frm%val == 12) THEN
r = -1.0_XP
ELSE
r = REAL(frm%val, XP)
END IF
RETURN
END SUBROUTINE toFramed

SUBROUTINE toFrames(this, frm, r)
USE HS2Kinds, ONLY: XP => SP
CLASS(HSFrame), INTENT(IN) :: this, frm
REAL(XP), INTENT(INOUT) :: r(3)
! Dummy code
IF (this%val == 12 .AND. frm%val == 12) THEN
r = -1.0_XP
ELSE
r = REAL(frm%val, XP)
END IF
RETURN
END SUBROUTINE toFrames
END MODULE HS2Frame

PROGRAM test
USE HS2Kinds
USE HS2Frame, ONLY: ITRF, ICRF
REAL(DP) :: r(3)
CALL ICRF%toFramed(ITRF, r)
!ICE: Internal error
CALL ICRF%toFrame(ITRF, r)
END PROGRAM test

Viewing all articles
Browse latest Browse all 27

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>