 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
lgriffiths
Joined: 09 Feb 2010 Posts: 3
|
Posted: Sat Feb 13, 2010 8:12 pm Post subject: Odd behaviour with automatic arrays (ftn95 express) |
|
|
I'm using ftn95 express with visual studio 2008. After testing with some previous code which compiles and runs fine with the intel compiler, i'm getting strange behaviour with the ftn95 when using debug.
The array in sub_B has undefined entries, even after being zero'd. (I'm inserting a breakpoint and putting a 'watch' on the array). Consequently any opperation i do using the array causes the debugger to abort (when \check is on). This goes away if i use allocatable or use a parameter for the array size.
Is this just me doing something stupid...?
ive included the simplist example i can think of:
Code: |
PROGRAM MAIN
INTEGER M
M=140
CALL sub_a(M)
END PROGRAM MAIN
SUBROUTINE SUB_A(M)
INTEGER, INTENT(in)::M
REAL,DIMENSION(M,2)::ARRAY
ARRAY=0.
END SUBROUTINE SUB_A
|
_________________ Well, Blimey! Lets have another go at it... Yeah! |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Sun Feb 14, 2010 1:01 pm Post subject: |
|
|
The problem is not with ftn95, but with sdbg.
If you try the following program, and step through sdbg, you can see that while sdbg shows the automatic array as being undefined, ftn95 does not. As you step through the test loop, the value of N does not change.
I think there is a later version of sdbg available in another post to download, which fixes this problem of viewing automatic arrays. I can't remember the post, someone else may help here.
Code: | PROGRAM MAIN
INTEGER M
M=140
CALL sub_a(M)
END PROGRAM MAIN
SUBROUTINE SUB_A(M)
INTEGER, INTENT(in)::M
REAL,DIMENSION(M,2)::ARRAY_au
real,allocatable, dimension(:,:) :: array_al
integer*4 i,j, n
!
ARRAY_au=0.
allocate (array_al(m,2))
!
array_al = 0.
write (*,1001) array_au(3,2), array_al(3,2)
1001 format (2f10.4)
!
n = 0
do i = 1,140
do j = 1,2
if (array_au(i,j) /= 0.) then
write (*,*) 'auto array',i,j,' = ', array_au(i,j)
n = n+1
end if
if (array_al(i,j) /= 0.) then
write (*,*) 'alloc array',i,j,' = ', array_al(i,j)
n = n+1
end if
end do
end do
END SUBROUTINE SUB_A
|
|
|
Back to top |
|
 |
Robert

Joined: 29 Nov 2006 Posts: 457 Location: Manchester
|
|
Back to top |
|
 |
lgriffiths
Joined: 09 Feb 2010 Posts: 3
|
Posted: Mon Feb 15, 2010 1:01 pm Post subject: |
|
|
thank you  _________________ Well, Blimey! Lets have another go at it... Yeah! |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|