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/35892] gfortran lost memory blocks



------- Comment #18 from george at gcc dot gnu dot org  2008-04-24 08:29 -------
I've investigated the PR code further.  The relevant parts of the code are
structured like so:

module mod
  integer aa, bb
  common /oof/ aa,bb
contains
  subroutine sub
  i = max(0,aa-1)
  print *, i, aa, bb
  end subroutine sub

  subroutine subb
  common /oof/ ic,id
  print *, ic, id
  end subroutine subb
end module

program test
  use mod
  common /oof/ ii,jj

  ii = 42
  jj = ii / 2
  print *, ii, jj
  call sub
  call subb
end program test

(A main program isn't in the PR, but I added one for debugging.)  The COMMON
appears both in the module scope, and in the local scope of one of the
procedures in the module.  When the storage layout is made for the COMMON at
module scope, the decls get thrown away too early if they are chained to the
(non-existent) procedure scope; further references to those identifiers in
procedure sub are in peril.  Chaining the decls to the global scope for
module-scope COMMON seems to be appropriate here and fixes the segfault for the
PR code.

I will rework the patch to include this case.  There is still the outstanding
problem of lost memory blocks unrelated to the original patch.   Any further
progress on that?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35892


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