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

Array section passing problem

Dieter_B_
Beginner
1,287 Views
I have a problem with a program, and reduced it to this mini-program:

program SEC_TEST
! To test passing array sections to a procedure.
implicit none

integer :: i, N=8
real,allocatable :: X(:)

ALLOCATE (X(0:N))
do i = 1, N
X(i) = i
enddo
print '(" X values stride 1:", 9f6.1)', X(0:N)
print '(" X values stride 2:", 9f6.1)', X(0:N:2)
print '(" X values stride 4:", 9f6.1)', X(0:N:4)
print *
call SUB (X(0:N), N)
call SUB (X(0:N:2), N/2)
call SUB (X(0:N:4), N/4)
DEALLOCATE (X)
end program SEC_TEST

subroutine SUB (X, N)

integer :: N
real :: X(0:N)

print '(" Passed X values :", 9f6.1)', X(0:N)

end subroutine SUB

The output is this:

X values stride 1: 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0
X values stride 2: 0.0 2.0 4.0 6.0 8.0
X values stride 4: 0.0 4.0 8.0

Passed X values : 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0
Passed X values : 0.0 1.0 2.0 3.0 4.0
Passed X values : 0.0 1.0 2.0

This is not what is supposed to happen. What is wrong?
Dieter Britz britzchem.au.dk

0 Kudos
13 Replies
TimP
Honored Contributor III
1,287 Views
This looks like a good case for a problem report on you premier.intel.com account. I got the same result with ifort 10.0.026 32-bit, while it works correctly with gfortran 4.3.0 20070824.
0 Kudos
Dieter_B_
Beginner
1,287 Views
I was hoping that Steve Lionel would see this and react. How do I make
a problem report? I can log in, but where do I go from there?

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,287 Views

Britz,

The following is a work around (until the bug is fixed)

program

SEC_TEST

! To test passing array sections to a procedure.

implicit none

interface

subroutine SUB (X, N)

integer :: N

real :: X(:)

end subroutine SUB

end interface

integer :: i, N=8

real,allocatable :: X(:)

ALLOCATE (X(0:N))

do i = 0, N

X(i) = i

enddo

print '(" X values stride 1:", 9f6.1)', X(0:N)

print '(" X values stride 2:", 9f6.1)', X(0:N:2)

print '(" X values stride 4:", 9f6.1)', X(0:N:4)

print *

call SUB (X(0:N:1), N)

call SUB (X(0:N:2), N/2)

call SUB (X(0:N:4), N/4)

DEALLOCATE (X)

end

program SEC_TEST

subroutine

SUB (X, N)

integer :: N

real :: X(:)

print '(" Passed X values :", 9f6.1)', X

end subroutine

SUB

Use an inteface block for the subroutine and defered shape

*** Note that the subscripts inside the SUB

are 1:N+1. So you may have to muck around with

with the indexing

integer :: SliceHack = 1

do I=0, N

X(I+SliceHack) = ...

or

do I=0+SliceHack,N+SliceHack

X(I) = ...

Jim Dempsey

0 Kudos
Steven_L_Intel1
Employee
1,287 Views
You submit problem reports to Intel Premier Support, as described in the product documentation. You can start here.

This problem sounds vaguely familiar to me but I can't readily find it in our tracking system.

0 Kudos
Steven_L_Intel1
Employee
1,287 Views
When you report this, please reference T80051-CP. Curiously, replacing ALLOCATABLE with POINTER makes it behave correctly. The developers here are very puzzled by this bug and are looking at it.
0 Kudos
Dieter_B_
Beginner
1,287 Views
Aaargh, sorry, I didn't see the bit about the reference number until after
I submitted the problem.
Dieter

0 Kudos
TimP
Honored Contributor III
1,287 Views
Attach a comment to your issue.

0 Kudos
Steven_L_Intel1
Employee
1,287 Views
Dieter,

I can't see any recent submission from you. What's the issue number?
0 Kudos
Steven_L_Intel1
Employee
1,287 Views
This bug has been fixed in our sources - it affects allocatable arrays only. The fix will appear in a future update.
0 Kudos
Steven_L_Intel1
Employee
1,287 Views
A workaround is to add the switch "-switch fe_not_contig".
0 Kudos
Dieter_B_
Beginner
1,287 Views
I am told that the issue has now been resolved (quick action!). But when I
check up on the latest update, it seems to be from 24. August. So I had
better wait a bit before updating.

I carefully read the documentation that came with the installation, and I do
not find instructions on how to update. How do I do it, please? Is it a new
installation, which replaces the one already in place, or is it a simpler process?

0 Kudos
TimP
Honored Contributor III
1,287 Views
Lately, the linux compiler update installations have been independent of previous ones. Each update suggests installing in a new directory, so that the old ones remain available until removed.
0 Kudos
Steven_L_Intel1
Employee
1,287 Views
The issue is resolved only in the sense that a fix has been checked in to the compiler sources. You won't see it until a future update - the support engineer who is handling your issue is supposed to let you know when the update with the fix is available.
0 Kudos
Reply