Author Message
DietmarSiepmann

Joined: 03 Jun 2013
Posts: 179 Posted: Thu May 18, 2017 11:34 am    Post subject: Problem DATA/EQUIVALENCE Statement When using the DATA and EQUIVALENCE statement twice with respect to 2 strings and 2 integer arrays the contents of the second integer array does not correspond to the contents of the data statement.
 Code: CHARACTER*16      *MYTXT1,           *MYTXT2             INTEGER*4         *MYIARRAY1(4),      *MYIARRAY2(4)                                                         EQUIVALENCE(MYTXT1,MYIARRAY1)                                  EQUIVALENCE(MYTXT2,MYIARRAY2)                                        DATA MYIARRAY1 /      *11 ,  12 ,  13 ,  14 /       DATA MYIARRAY2 /      *21 ,  22 ,  23 ,  24 /             write(2,'(A13,I16,2X,A16,I32)') 'MYIARRAY1(1)=',MYIARRAY1(1),      *'LOC(MYIARRAY1(1))=',LOC(MYIARRAY1(1))       write(2,'(A13,I16,2X,A16,I32)') 'MYIARRAY2(1)=',MYIARRAY2(1),      *'LOC(MYIARRAY2(1))=',LOC(MYIARRAY2(1))       stop       end

The 64 bit executable prints the lines

MYIARRAY1(1)=21 LOC(MYIARRAY1(1))= 4214896
MYIARRAY2(1)=21 LOC(MYIARRAY2(1))= 4214896

However, we expect both the values of MYIARRAY1(1) and MYIARRAY2(1) and their locations to be different, respectively.

The 32 bit version of the code printes then lines

MYIARRAY1(1)=11 LOC(MYIARRAY1(1))= 4210704
MYIARRAY2(1)=21 LOC(MYIARRAY2(1))= 4210688

which matches my expectations.

If commenting/deactivating the second EQIVALENCE statement and creating the corresponding 64 bit executable, the 64 bit executable prints

MYIARRAY1(1)=11 LOC(MYIARRAY1(1))= 4214896
MYIARRAY2(1)=21 LOC(MYIARRAY2(1))= 4214912

which again matches my expectations.

Regards,
Dietmar   JohnCampbell

Joined: 16 Feb 2006
Posts: 2111
Location: Sydney Posted: Fri May 19, 2017 1:23 am    Post subject: There is definitely a problem with /64. I tested in Plato with Debug x64.
I initially tried to separate the definitions, but that did not fix the problem.
Commenting out the data definition on lines 4 and 8 removes the reported error for /64 ( or the data statements in the original post)
 Code: c  equiv.for c        CHARACTER*16 MYTXT1        INTEGER*4 :: MYIARRAY1(4)  = (/ 11 ,  12 ,  13 ,  14 /)        EQUIVALENCE (MYTXT1,MYIARRAY1) c        CHARACTER*16 MYTXT2        INTEGER*4 :: MYIARRAY2(4)  = (/ 21 ,  22 ,  23 ,  24 /)        EQUIVALENCE (MYTXT2,MYIARRAY2) c               write (*,*) 'mytxt1   ',loc (mytxt1)        write (*,*) 'mytxt2   ',loc (mytxt2)        write (*,*) 'MYIARRAY1',loc (MYIARRAY1)        write (*,*) 'MYIARRAY2',loc (MYIARRAY2) c        MYIARRAY1 = (/ 11 ,  12 ,  13 ,  14 /)        MYIARRAY2 = (/ 21 ,  22 ,  23 ,  24 /) c        write (2,'(A13,I16,2X,A16,I32)') 'MYIARRAY1(1)=',MYIARRAY1(1),      *  'LOC(MYIARRAY1(1))=',LOC(MYIARRAY1(1))        write (2,'(A13,I16,2X,A16,I32)') 'MYIARRAY2(1)=',MYIARRAY2(1),      *  'LOC(MYIARRAY2(1))=',LOC(MYIARRAY2(1))        stop c        end   PaulLaidler Joined: 21 Feb 2005
Posts: 6004
Location: Salford, UK Posted: Fri May 19, 2017 9:05 am    Post subject: I have made a note that this needs fixing.   PaulLaidler Joined: 21 Feb 2005
Posts: 6004
Location: Salford, UK Posted: Mon Jun 05, 2017 3:46 pm    Post subject: This has now been fixed for the next release of FTN95.   Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT + 1 Hour Page 1 of 1