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

Automatic allocation of arrays in fortran is not working

Hazra__Dhiraj_Kumar
430 Views

Hello,

    I am using ifort 15.0.1. I know that the automatic allocation works in fortran 2008. I got it working with gfortran. But it seems ifort is not able to compile such programs appropriately. Below is a simple program :

program testing
  implicit none
  real,allocatable,dimension (:):: a,b
  allocate(a(10))
  a = 1.0
  b = a
  print*,size(b)
end program

   The array "b" should get the allocation of array "a" along with its values. When I compile with gfortran, the program prints 10, but for ifort it prints 0. Is this feature of F2008 supported yet in ifort ?

Regards,

Dhiraj

 

 

 

  

 

 

 

0 Kudos
3 Replies
Kevin_D_Intel
Employee
430 Views

I believe this is a Fortran Standard feature requiring an additional option to enable, either -assume realloc_lhs or -standard-semantics. The program prints 10 with either option.

Refer to Intel® Fortran Compiler - Support for Fortran language standards for additional information.

0 Kudos
Hazra__Dhiraj_Kumar
430 Views

Thanks a lot Kevin. It worked.

0 Kudos
Kevin_D_Intel
Employee
430 Views

You're welcome.

0 Kudos
Reply