replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - problem regarding pointers/allocate etc.
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 

problem regarding pointers/allocate etc.

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



Joined: 24 Jan 2012
Posts: 2
Location: Netherlands

PostPosted: Tue Jan 24, 2012 6:23 pm    Post subject: problem regarding pointers/allocate etc. Reply with quote

Dear Fortran experts!

The test program below gives unexpected results with version 6.20 (and older versions).
Other compilers (gnu fortran, intel fortran) seem to work fine.
For example, the outcome of g95 is:

..... zeros for N=1 and 2
3 1 1 11
3 2 1 21
3 3 1 31
3 4 1 41
3 1 2 12
3 2 2 22
3 3 2 32
3 4 2 42
3 1 3 13
3 2 3 23
3 3 3 33
3 4 3 43
4 1 1 0
4 2 1 0
4 3 1 0
4 4 1 0
4 1 2 0
4 2 2 0
4 3 2 0
4 4 2 0
4 1 3 0
4 2 3 0
4 3 3 0
4 4 3 0
.... more zeros for N=5 to 10

as expected, whereas the outcome of ftn95 v6.20 has a shift and two missing numbers:

..... zeros for N=1 and 2
3 1 1 11
3 2 1 21
3 3 1 31
3 4 1 41
3 1 2 0
3 2 2 0
3 3 2 0
3 4 2 0
3 1 3 0
3 2 3 0
3 3 3 12
3 4 3 22
4 1 1 0
4 2 1 0
4 3 1 0
4 4 1 0
4 1 2 13
4 2 2 23
4 3 2 33
4 4 2 43
4 1 3 0
4 2 3 0
4 3 3 0
4 4 3 0
.... zeros for N=5 to 10

Please help!

Regards,

Roel

C ---------------------------------------------------------------------
C
PROGRAM POINTER_TEST
C
IMPLICIT NONE

c----------------------------------------
type realarray
integer,dimension(:,Smile,pointer :: arr
END type realarray

type(realarray), dimension(10), target :: lst_fb
integer, dimension(:,Smile, pointer :: fb
c----------------------------------------

integer i,j,ierr,N

DO N=1,10
ALLOCATE(lst_fb(N)%arr(4,3),stat = ierr)
if (ierr.ne.0) then
print *,'allocation error'
stop
endif
ENDDO

DO N=1,10
DO J = 1, 3
DO I = 1, 4
lst_fb(N)%arr(i,j)=0
ENDDO
ENDDO
ENDDO

fb => lst_fb(3)%arr

DO J = 1, 3
DO I = 1, 4
FB(i,j) = i*10+j
ENDDO
ENDDO

DO N=1,10
DO J = 1, 3
DO I = 1, 4
print*,N,i,j,lst_fb(N)%arr(i,j)
ENDDO
ENDDO
ENDDO

STOP
END
C
C ---------------------------------------------------------------------
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Wed Jan 25, 2012 11:06 am    Post subject: Reply with quote

I have logged this as a bug in FTN95. Here is a minimal program that illustrates the bug...

Code:
      PROGRAM POINTER_TEST
c----------------------------------------
      TYPE array
      INTEGER arr(4,3)
      END TYPE array
     
      TYPE(array),TARGET::lst_fb(10)
       
      INTEGER,DIMENSION(:,:),POINTER::fb
c----------------------------------------
      lst_fb(3)%arr(1,2)=42
      fb => lst_fb(3)%arr
      fb(1,2) = 12 ! fb(3,3) is changed not fb(1,2)
      print*, lst_fb(3)%arr(1,2)
      END
Back to top
View user's profile Send private message AIM Address
Roel



Joined: 24 Jan 2012
Posts: 2
Location: Netherlands

PostPosted: Fri Jan 27, 2012 7:41 am    Post subject: Reply with quote

Thanks Paul!
I suppose this will be fixed in the new release?
I so, when is a new release scheduled?

Roel
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Fri Jan 27, 2012 10:02 am    Post subject: Reply with quote

We will aim to have it fixed for the next release which would normally be towards the end of 2012.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Tue Mar 06, 2012 2:37 pm    Post subject: Reply with quote

This bug has now been fixed for the next release of FTN95.
Back to top
View user's profile Send private message AIM Address
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