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

problem with 4+ dimension allocatable arrays and optimized code

avidard
Beginner
718 Views
Hi all,

I am experiencing some curious behavior when trying to allocate a 4 dimensional array. it happens on a snow leopard core 2 duo MBP with a 64 byte kernel, with the latest ifort (11.1 088) with an evaluation license.
(on a leopard with 32bit kernel and an older version of ifort, I did not manage to reproduce the problem)

I manage to reproduce the problem with the following simplistic program:
[bash]PROGRAM boulishgu
   IMPLICIT NONE
   REAL, DIMENSION(:,:,:,:), ALLOCATABLE :: t
   INTEGER :: ierr
   INTEGER :: i, j, k, l
   INTEGER, PARAMETER :: pi = 2, pj = 2, pk = 2, pl = 2

   ALLOCATE (t (pi, pj, pk, pl), STAT=ierr)


   PRINT*,'t allocated', ierr

   DO l = 1, pl
      DO k = 1, pk
         DO j = 1, pj
            DO i= 1, pi
               PRINT*, i, j, k, l
               t(i, j, k, l) = 2.*i
               PRINT*, t(i, j, k, l)
            END DO
         END DO
      END DO
   END DO
   
   PRINT*,'sum t',SUM(t)

   DEALLOCATE(t)

END PROGRAM boulishgu[/bash]

if I compile it with the -g flag only, everything is fine and I get my answer

However, if I use any optimization level whatsoever, the execution failed when trying to access any t(:,:,:,2) (I get an abort trap message).

the value of the dimensions pi, pj, pk does not seem to matter, as long as they are >= 2

If the array t is only 3 dimensional (or pl=1), everything is fine, for both -g and -On flags

any idea ?

thanks,

Arthur
0 Kudos
3 Replies
Steven_L_Intel1
Employee
718 Views
Make sure that you are not using XCode 3.2.2. See here.
0 Kudos
Ron_Green
Moderator
718 Views
it is the Xcode 3.2.2 problem. Runs fine for 11.1.088 under Xcode 3.2.1. Aborts for 11.1.088 under Xcode 3.2.2

ron
0 Kudos
avidard
Beginner
718 Views
Thank you very much, that was the problem indeed.
Sorry I missed the fact that I was using Xcode 3.2.2
0 Kudos
Reply