[Bug fortran/22304] gfortran silently changes values in equilvanence'd variables
pault at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Aug 5 06:08:00 GMT 2005
------- Additional Comments From pault at gcc dot gnu dot org 2005-08-05 06:08 -------
This is amusing.....
integer o(4), b, c
COMMON /IBM/ o
EQUIVALENCE (o(1),b),(C,o(4))
o(3)=1
CALL MYSUB1
CALL MYSUB2
END
subroutine MYSUB1
integer o (4), b, c
COMMON /IBM/ o
EQUIVALENCE (o(1), b), (o(4), c)
WRITE (6,*) "IN MYSUB1: o(3)= ", o(3)
RETURN
END
subroutine MYSUB2
integer o (4), b, c
COMMON /IBM/ o
EQUIVALENCE (o(1), b), (c, o(4))
WRITE (6,*) "IN MYSUB2: o(3)= ", o(3)
RETURN
END
IN MYSUB1: o(3)= 0
IN MYSUB2: o(3)= 134519416
The code shows that SUB1 references the common block, whereas SUB2 goes for a
home grown equivalence. This is a good clue as to where things are failing.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22304
More information about the Gcc-bugs
mailing list