This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/18518] equivalenced variables are not saved
- From: "Thomas dot Koenig at online dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Nov 2004 13:20:06 -0000
- Subject: [Bug fortran/18518] equivalenced variables are not saved
- References: <20041116103451.18518.Thomas.Koenig@online.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From Thomas dot Koenig at online dot de 2004-11-20 13:19 -------
> Hmmm, I do not get this on my powerpc-unknown-linux-gnu:
Here's a reduced assembly output:
$ gfortran -v
Reading specs from /home/ig25/lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Configured with: ../gcc/configure --prefix=/home/ig25 --enable-languages=c,c++,f95
Thread model: posix
gcc version 4.0.0 20041120 (experimental)
$ cat pr18518-test2.f90
subroutine foo
integer i,g,h
data i/0/
equivalence (g,h)
save g
if (i == 0) then
i = 1
h = 12345
end if
print *,h
end subroutine foo
$ gfortran -S pr18518-test2.f90
$ cat pr18518-test2.s
.file "pr18518-test2.f90"
.local i.456
.comm i.456,4,4
.section .rodata
.LC0:
.string "pr18518-test2.f90"
.text
.globl foo_
.type foo_, @function
foo_:
pushl %ebp
movl %esp, %ebp
subl $24, %esp
movl i.456, %eax
testl %eax, %eax
jne .L2
movl $1, i.456
movl $12345, -4(%ebp)
.L2:
movl $.LC0, _gfortran_filename
movl $10, _gfortran_line
movl $6, _gfortran_ioparm
movl $1, _gfortran_ioparm+16
call _gfortran_st_write
movl $4, 4(%esp)
leal -4(%ebp), %eax
movl %eax, (%esp)
call _gfortran_transfer_integer
call _gfortran_st_write_done
leave
ret
.size foo_, .-foo_
.ident "GCC: (GNU) 4.0.0 20041120 (experimental)"
.section .note.GNU-stack,"",@progbits
$
The "movl $12345, -4(%ebp)" above is clearly wrong - it loads the
value of 12345 into a stack location, not a saved location.
It would be good to check assembly output on your machine to
see wether the same problem occurs (even if the test example
doesn't show it).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18518