[Bug fortran/30689] New: equivalence modifies common block
milan at cmm dot ki dot si
gcc-bugzilla@gcc.gnu.org
Sat Feb 3 11:31:00 GMT 2007
I hope this is a new bug (I am not good at searching through bugzilla). I am
also not sure if this is according to standards, but as I undertand equivalence
is a harmless statement. It shouldn't change the lenght of the common block. I
am using gfortran -fdefault-integer-8 to compile gaussian-03 program on x86_64
machine. Everything works fine including GOMP stuff. Only the command to
reserve memory in the beginning doesn't work. One can use environment variable,
but it is annoying to tell every student, how to do it, so I decided to fix
also this and stumbled on the following problem:
program lstint
Implicit Integer(A-Z)
REAL FP
DOUBLE PRECISION DP
COMMON/QPSTAT/LASTYP,STATUS,CHRCTR,DIGIT,Intger,FP,dp,LENSTR
lenstr=15
write(*,*)'QPtran>enter:lenstr=',lenstr
Call QPutIt
End
Subroutine QPutIt
Implicit Integer(A-Z)
integer fpl,dpl(2)
integer LASTYP,STATUS,CHRCTR,DIGIT,Intger,LENSTR
Real FP
Double Precision DP
Common/QPStat/LASTYP,STATUS,CHRCTR,DIGIT,Intger,FP,DP,LENSTR
Equivalence (DPL,DP),(FPL,FP)
write(*,*)'QPutIt>start:lenstr=',lenstr
return
end
gfortran -fdefault-integer-8 -o x x.f
./x
lenstr=15
lenstr=0
Apparently the address of lenstr gets shifted in the subroutine because of the
equivalence statement. Is this the right behavior?
--
Summary: equivalence modifies common block
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: milan at cmm dot ki dot si
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30689
More information about the Gcc-bugs
mailing list