Allow Allocatable Arrays in Type Definitions for Linux ifort

Allow Allocatable Arrays in Type Definitions for Linux ifort

Ritratto di Billy G.

I have a fortran program that works fine when compiled on Visual Fortran 11 for Windows, that has been converted to compile/run on linux. 

It now compiles and links fine, but when running it throws a "allocatable array is already allocated" error when trying to allocate one of the data structures. Some debugging showed that the array was not, indeed, allocated. Some research showed that this happens because the old fortran standard did not allow allocatable arrays within a user-defined type (which this program uses). 

Visual Fortran for Windows does not seem to have a problem using the new standard for this, and the code runs fine. However on linux, this error comes up. The program is too large and complex to change the implementation to use pointers. Is there any way to get the linux compiler to work on allocatable arrays?

Again, it isn't a compile-time error, but one caught at run time (with that seemingly unrelated error). Another way to put the question is, is there any way to make linux ifort behave like the Windows one in this regard?

Any advice is greatly appreciated; thanks. 

3 post / 0 new
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di Casey

Can you provide a test case?  I threw together a quick one based on your statements (shown below) that compiled and ran fine using ifort 14.0.0 on linux.

module alloctype
implicit none
type at
 real, dimension(:,:), allocatable :: a
end type
end module
program main
use alloctype
implicit none
type(at) :: test
test%a = 1d0
end program main

Ritratto di Steve Lionel (Intel)

I am sure this has nothing to do with old standard vs. new standard, as support for allocatable components of derived type was added back in the CVF days and has been in the Intel compiler since 2003. Please do provide a test case.


Accedere per lasciare un commento.