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

Allocate Source= question

A__Valle
Начинающий
1 002Просмотр.

Dear all,

I have a question regarding the following code snippet:

[fortran]

MODULE TestModule !{

TYPE X0Type
  REAL(KIND=8), DIMENSION(:),ALLOCATABLE :: X
ENDTYPE
 
TYPE SL_DataStrucType
  REAL(KIND=8), DIMENSION(:), POINTER :: X
  TYPE(X0Type), DIMENSION(:), POINTER :: StoredX0    => null()
ENDTYPE SL_DataStrucType

TYPE(SL_DataStrucType),             POINTER :: DB_MMxSL_Data       => null()
TYPE(X0Type),        DIMENSION(:),  POINTER :: StoredX0    => null()

  CONTAINS
 
  SUBROUTINE Test()
    ALLOCATE(DB_MMxSL_Data%StoredX0(1))
    ALLOCATE(DB_MMxSL_Data%X, SOURCE=StoredX0(1)%X)
    ALLOCATE(DB_MMxSL_Data%X, SOURCE=DB_MMxSL_Data%StoredX0(1)%X)
  END SUBROUTINE

ENDMODULE TestModule !}

[/fortran]

There seems not to be any problem with the upper allocate statement, but when the allocate option Source= is encompassed in a structure, I get the following compiler diagnostic:

error #8152: Neither the ERRMSG= variable nor any part of the source expression in SOURCE= or MOLD= specifiers may be allocated in the ALLOCATE statement in which it appears.   [DB_MMXSL_DATA]

Can anyone explain the fundamental difference between the two allocate statements, that is causing in this error.

 

Dirk

0 баллов
4 Ответы
Roland_W_Intel1
Сотрудник
1 002Просмотр.

It  looks like both these statements should be accepted by the compiler.  I'll run this by our developers and let you know what they have to say.

Roland_W_Intel1
Сотрудник
1 002Просмотр.

Our developers agree this is a bug and will have a fix for it in the next update of our 14.0 Compiler (Composer XE 2013 SP1 Update 3).

A__Valle
Начинающий
1 002Просмотр.

Thanks Roland. Do you have a bug ID for me to track?

Steven_L_Intel1
Сотрудник
1 002Просмотр.

I believe it is DPD200250346.

Ответить