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

Internal compiler error: Procedure pointer to type bound procedure

abhimodak
New Contributor I
273 Views
Hi

(1) The snippet below gives an internal compiler error. I can also create variants of it that would give a 'catastrophic error' by using the procedure pointer component of a type pointing to procedure of another type.

(2) I accidently noticed that if "contains" statement is omitted/commented-out in the module that has a type definition with type-bound procedure, the compiler gives error as "end statement confusion". If a type bound procedure is not there, the diagnostic correctly points to Subroutine (or Function) line with message "This statement is positioned incorrectly". I think the latter is better since, at least, it gives the correct location of the error.

Abhi

====

Module myType

Implicit None

Type newObject
Integer :: i
Contains
Procedure :: Method
End Type newObject

Contains

Subroutine Method(Object, r)
Implicit None
Class(newObject) :: Object
Real :: r
End Subroutine Method

End Module myType

Program Test_Procedure

Use myType

Implicit None

Type(newObject) :: Object

Procedure(), Pointer :: Dummy

Dummy => Object%Method

End Program Test_Procedure
0 Kudos
1 Reply
Steven_L_Intel1
Employee
273 Views
Thanks - we'll investigate. Issue is DPD200139701
0 Kudos
Reply