This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/22304] gfortran silently changes values in equilvanence'd variables
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Aug 2005 06:08:42 -0000
- Subject: [Bug fortran/22304] gfortran silently changes values in equilvanence'd variables
- References: <20050705050725.22304.albertm@uphs.upenn.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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