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

Bug in v11.0.054 with class pointer assignment to a type extension

konstantinos
Beginner
487 Views
!=================================================================================
! TestFile.f90
!
! By Konstantinos, last modified 19/12/09
!=================================================================================

MODULE TestParentObjectDerDataTypes

IMPLICIT NONE

TYPE TestParentObject

REAL(KIND=8),DIMENSION(:),POINTER:: RealParameter

END TYPE TestParentObject

END MODULE TestParentObjectDerDataTypes

!============================================================================

MODULE TestExtendedObjectDerDataTypes

USE TestParentObjectDerDataTypes

IMPLICIT NONE

TYPE,EXTENDS(TestParentObject):: TestExtendedObject
INTEGER(KIND=4):: IntegerParameter
END TYPE TestExtendedObject

END MODULE TestExtendedObjectDerDataTypes

!============================================================================

MODULE TestSubroutineInterface

INTERFACE
SUBROUTINE TestSubroutine

IMPLICIT NONE

END SUBROUTINE TestSubroutine
END INTERFACE

END MODULE TestSubroutineInterface

!============================================================================

SUBROUTINE TestSubroutine

USE TestParentObjectDerDataTypes
USE TestExtendedObjectDerDataTypes

IMPLICIT NONE

TYPE(TestExtendedObject),TARGET:: ExtObjPtr
CLASS(TestParentObject),POINTER:: ParObjPtr

ParObjPtr => ExtObjPtr

END SUBROUTINE TestSubroutine

!============================================================================

PROGRAM Test

USE TestSubroutineInterface

IMPLICIT NONE

CALL TestSubroutine

END PROGRAM Test

--------------------------------

The following piece of code will compile fine under version 11.1 Update 4 (11.1.054) but will give
the followingerror at runtime:

forrtl: severe (157): Program Exception - access violation
Image PC Routine Line Source
Test.exe 0040101A _TESTSUBROUTINE 60 TestFile02.f90
Test.exe 00401095 _MAIN__ 72 TestFile02.f90
Test.exe 004A2E53 Unknown Unknown Unknown
Test.exe 00447083 Unknown Unknown Unknown
Test.exe 00446E4D Unknown Unknown Unknown
kernel32.dll 7C816FE7 Unknown Unknown Unknown

The code is similar to the examplefrom

ISO/IEC JTC1/SC22/WG5 N1579
The New Features of Fortran 2003
John Reid, WG5 Convener
section 2.12 pp.14


Are there any known workarounds to get a class pointer to point at a type extension?

Konstantinos
0 Kudos
2 Replies
konstantinos
Beginner
487 Views
Any suggestions on this???

0 Kudos
Steven_L_Intel1
Employee
487 Views

I apologize for not responding earlier.

This bug is triggered by having /gen-interface enabled. It appears to be the same one reported here and is fixed for Update 5, currently planned for the second week of February. As a workaround, disable "Generate Interface Blocks" and "Check Routine Interfaces" under Diagnostics/

0 Kudos
Reply