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

Internal compiler error with type bound procedure

hs-napa
Beginner
678 Views
Hi,

I ran into an internal compiler error when implementing a simple linked list containing derived types. I managed to isolate the problem to a trivial test case that reproduces the error. The test program does not do anything useful, it only manages to crash the compiler when compiled.

[bash]MODULE TEST_MOD
   IMPLICIT NONE
   TYPE TEST_TYPE
      CHARACTER(LEN=:), ALLOCATABLE :: STR
   END TYPE
END MODULE

MODULE LIST_MOD
   USE TEST_MOD
   IMPLICIT NONE
   TYPE :: LIST
      TYPE(TEST_TYPE), POINTER :: OBJ => NULL()
      TYPE(LIST), POINTER :: NEXT => NULL()
   CONTAINS
      PROCEDURE :: TAIL => LIST_TAIL
   END TYPE
CONTAINS
   FUNCTION LIST_TAIL( THIS )
      CLASS(LIST) :: THIS
      TYPE(LIST) :: LIST_TAIL
      IF (ASSOCIATED( THIS % NEXT ) ) THEN
         LIST_TAIL % NEXT => THIS % NEXT % NEXT
         LIST_TAIL % OBJ => THIS % NEXT % OBJ
      END IF
   END FUNCTION
END MODULE

PROGRAM TEST
   USE LIST_MOD
   IMPLICIT NONE
   TYPE(LIST) :: L, TAIL
   TAIL = LIST_TAIL(L)
   TAIL = L % TAIL()
END PROGRAM[/bash]
Compiling this gives the following error message:

ifort test.f90

->

Intel Visual Fortran Compiler Professional for applications running on IA-32, Version 11.1    Build 20091130 Package ID: w_cprof_p_11.1.054
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

fortcom: Fatal: There has been an internal compiler error (C00000FD).
compilation aborted for test.f90 (code 1)


The problem seems to be compling the call to TAIL type bound procedure with the OO syntax at line 33. If this line is commented out the program compiles nicely.

I found a workaround to the problem. If the LIST_TAIL function is modified to return an allocatable type, the code compiles and works ok.

[bash]   FUNCTION LIST_TAIL( THIS )
      CLASS(LIST) :: THIS
      TYPE(LIST), ALLOCATABLE :: LIST_TAIL
      ALLOCATE( LIST_TAIL )
      IF (ASSOCIATED( THIS % NEXT ) ) THEN
         LIST_TAIL % NEXT => THIS % NEXT % NEXT
         LIST_TAIL % OBJ => THIS % NEXT % OBJ
      END IF
   END FUNCTION
[/bash]


0 Kudos
4 Replies
Steven_L_Intel1
Employee
678 Views
Thanks - I can reproduce this. I'll report it to the developers.
0 Kudos
Steven_L_Intel1
Employee
678 Views
It turns out that this is already fixed for our next major release, due out soon.
0 Kudos
hs-napa
Beginner
678 Views
Great!

When is the expected release date?

-Heikki
0 Kudos
Steven_L_Intel1
Employee
677 Views
Sometime in November.
0 Kudos
Reply