- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello all. I'm wondering if this is a compiler bug or a nuance of fortran 90 I'm not familiar with. If I have a two dimensional array in F90, a, and I pass a subset of the array to a subroutine:
call calc_norm(a(1:3,2),a(4:6,2))
the intel compiler only seems to get the reference of the first element of a, no matter what the index is. That is in the function:
subroutine calc_norm(r1,r2)
real(kind(0d0)), dimension(3) :: r1, r2
r1 and r2 are equal in the subroutine. Even if i specify a(3:5,2) as the first arugment calc_norm still only gets a(1:3,2). Interestingly enough if I print the subsets they are correct. Am I missing something? At the very least the results are inconsistent. Using:
Intel Fortran Compiler for 32-bit applications, Version 9.0 Build 20050430Z Package ID:
Copyright (C) 1985-2005 Intel Corporation.
All rights reserved. FOR NON-COMMERCIAL USE ONLY
Centos 4.2, 2.6.9-22.0.1.EL #1
Attached is a sample program to illustrate what I mean:
module testsplice
implicit none
contains
subroutine check(chunk1, chunk2)
implicit none
real(kind(0d0)), dimension(5) :: chunk1, chunk2
print *, '1', chunk1
print *, '2', chunk2
end subroutine check
end module testsplice
program splice
use testsplice
implicit none
real(kind(0d0)), dimension(10,10) :: myarray
integer :: i, j, counter
counter=1
do i=1,10
do j=1,10
myarray(j,i)=float(counter)
counter=counter+1
enddo
enddo
print *, myarray
call check(myarray(1:5,2), myarray(6:10,2))
end program splice
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
However, your statement that "if I print the subsets they are correct" is confusing - how are you determining that the arrays are not correct?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For example, if I add a line:
print *, myarray(6:10,2)
To the program above, it reports (correctly):
16.0000000000000 17.0000000000000 18.0000000000000
19.0000000000000 20.0000000000000
However in the subroutine, I obtain:
1 11.0000000000000 12.0000000000000 13.0000000000000
14.0000000000000 15.0000000000000
2 11.0000000000000 12.0000000000000 13.0000000000000
14.0000000000000 15.0000000000000
As for using an old compiler, I'm using the latest non-commerical version you are offering (downloaded two or three weeks ago). It seems silly to be distributing this compiler (even for free) if there are major bugs like this? At the very least is makes it hard to evaluate it for purchase. Perhaps this is a platform specific issue or a language technicality I'm missing?
Jeff Ludwig
University of Delaware
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree with you that asking people to evaluate an old compiler is perhaps not the best strategy.
The current compiler gets this right.
Message Edited by Steve_Lionel on 12-20-2005 03:39 PM
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page