This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/30689] New: equivalence modifies common block


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]