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

Associate + Deferred length + Allocate don't like each other

IanH
Honored Contributor III
408 Views
This little example:

[fortran]MODULE AssociateAndAllocate
  IMPLICIT NONE  
  !----
  TYPE :: b_type
    INTEGER :: b_comp
  END TYPE b_type
  
  TYPE, PUBLIC :: a_type
    TYPE(b_type), ALLOCATABLE :: a_comp(:)
  END TYPE a_type
CONTAINS  
  SUBROUTINE proc(a)
    !----
    TYPE(a_type), INTENT(INOUT) :: a    
    !----
    CHARACTER(:), ALLOCATABLE :: tmp(:)
    !****
    ASSOCIATE(assoc => a%a_comp(1))
      assoc%b_comp = 10      
      ALLOCATE(CHARACTER(assoc%b_comp):: tmp(5))          
    END ASSOCIATE
  END SUBROUTINE proc  
END MODULE AssociateAndAllocate
[/fortran]
gives this:

[plain]>ifort /warn:all /check:all AssociateAndAllocate.f90
Intel Visual Fortran Compiler XE for applications running on IA-32, Version 1
2.0.1.127 Build 20101116
Copyright (C) 1985-2010 Intel Corporation.  All rights reserved.

0_12307

: catastrophic error: **Internal compiler error: internal abort** Please report
this error along with the circumstances in which it occurred in a Software Probl
em Report.  Note: File and line given may not be explicit cause of this error.
compilation aborted for AssociateAndAllocate.f90 (code 1)[/plain]

If you add /standard-semantics, the error goes away with this specific example, but not in my original source.
0 Kudos
3 Replies
Wendy_Doerner__Intel
Valued Contributor I
408 Views
I have reproduced and reported to engineering with a request for a workaround. I will update this thread when I have more information. The tracking number is: DPD200165006

------

Wendy

Attaching or including files in a post

0 Kudos
Wendy_Doerner__Intel
Valued Contributor I
408 Views
Not a great workaround, but I find if I remove /check:all the internal compiler no longer occurrs.

Wendy

Attaching or including files in a post

0 Kudos
IanH
Honored Contributor III
408 Views
My planned workaround was to replace the associate-name in the type-spec in the allocate statement with the full "selector", but (with /check:all still on) that just creates a runtime issue...

[fortran]MODULE AssociateAndAllocateDeluxe
  IMPLICIT NONE  
  !----
  TYPE :: b_type
    INTEGER :: b_comp
  END TYPE b_type
  
  TYPE, PUBLIC :: a_type
    TYPE(b_type), ALLOCATABLE :: a_comp(:)
  END TYPE a_type
CONTAINS  
  SUBROUTINE proc(a)
    !----
    TYPE(a_type), INTENT(INOUT) :: a    
    !----
    CHARACTER(:), ALLOCATABLE :: tmp(:)
    INTEGER :: i
    !****
    i = 1
    ASSOCIATE(assoc => a%a_comp(i))
      assoc%b_comp = 10      
      ALLOCATE(CHARACTER(a%a_comp(i)%b_comp):: tmp(5))          
    END ASSOCIATE
  END SUBROUTINE proc  
END MODULE AssociateAndAllocateDeluxe

PROGRAM driver
  USE AssociateAndAllocateDeluxe
  !****
  TYPE(a_type) :: a
  ALLOCATE(a%a_comp(1))
  CALL proc(a)
END PROGRAM driver
[/fortran]

[plain]>ifort /warn:all /check:all /standard-semantics AssociateAndAllocateDeluxe.f90
Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.0.1.127 Build 20101116
...



>AssociateAndAllocate.exe
forrtl: severe (193): Run-Time Check Failure. The variable '_ASSOCIATEANDALLOCAT
EDELUXE_mp_PROC$I' is being used without being defined
Image              PC        Routine            Line        Source
AssociateAndAlloc  0042E33A  Unknown               Unknown  Unknown
AssociateAndAlloc  0042B9D8  Unknown               Unknown  Unknown
AssociateAndAlloc  0040498A  Unknown               Unknown  Unknown
AssociateAndAlloc  00405472  Unknown               Unknown  Unknown
AssociateAndAlloc  004010AC  Unknown               Unknown  Unknown
AssociateAndAlloc  00401083  Unknown               Unknown  Unknown
AssociateAndAlloc  0042EC83  Unknown               Unknown  Unknown
AssociateAndAlloc  00419774  Unknown               Unknown  Unknown
kernel32.dll       7C817077  Unknown               Unknown  Unknown[/plain]
I'll just de-associate-statement the code.
0 Kudos
Reply