replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Odd behaviour with automatic arrays (ftn95 express)
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Odd behaviour with automatic arrays (ftn95 express)

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
lgriffiths



Joined: 09 Feb 2010
Posts: 3

PostPosted: Sat Feb 13, 2010 8:12 pm    Post subject: Odd behaviour with automatic arrays (ftn95 express) Reply with quote

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
View user's profile Send private message
JohnCampbell



Joined: 16 Feb 2006
Posts: 2615
Location: Sydney

PostPosted: Sun Feb 14, 2010 1:01 pm    Post subject: Reply with quote

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
View user's profile Send private message
Robert



Joined: 29 Nov 2006
Posts: 457
Location: Manchester

PostPosted: Sun Feb 14, 2010 6:37 pm    Post subject: Reply with quote

http://forums.silverfrost.com/viewtopic.php?t=1441
Back to top
View user's profile Send private message Visit poster's website
lgriffiths



Joined: 09 Feb 2010
Posts: 3

PostPosted: Mon Feb 15, 2010 1:01 pm    Post subject: Reply with quote

thank you Very Happy
_________________
Well, Blimey! Lets have another go at it... Yeah!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
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