This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[fortran,patch] Don't write common more than once in a module file (PR 30285)
- From: FX Coudert <fxcoudert at gmail dot com>
- To: "fortran at gcc dot gnu dot org List" <fortran at gcc dot gnu dot org>
- Cc: gcc-patches list <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 10 Nov 2007 01:09:35 +0000
- Subject: [fortran,patch] Don't write common more than once in a module file (PR 30285)
PR 30285 is about deeply nested module files containing commons,
which take a huge amount of memory when they're read back (and loads
of disk space, but that's not so much of a problem). This commonly
happens with MPICH and openmpi, and leads some people to run out of
memory when compiling mpi-enabled programs.
The problem is that we write each common name more than once (a
number of times that grows exponentially with the nesting). I tried
to change the way we load modules, to avoid creating these duplicate
symbols, but the diagnostics code for commons with binding labels
requires this creation of multiple symbols, so I went for something
that is a bit of a hack: we get rid of duplicate common names
(specificaly: duplicate pairs of name and binding label) when writing
the module files, by creating a list of them as we go through and
checking them against that list.
I agree it's not a perfect solution, but I couldn't make it work in
any other way (see the PR for a tentative patch), and I think it's
worth committing now, as it's a serious problem for our users.
Regtested on x86_64-linux, OK to commit?
FX
:ADDPATCH fortran:
Attachment:
pr30285.ChangeLog
Description: Binary data
Attachment:
pr30285.diff
Description: Binary data