This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, fortran] fix for PR 60780, PR 40958
- From: Russell Whitesides <russelldub at gmail dot com>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 14 May 2015 20:53:11 -0700
- Subject: [patch, fortran] fix for PR 60780, PR 40958
- Authentication-results: sourceware.org; auth=none
Patch below prevents printing of duplicate statements in module files.
Without it module files grow exponentially in size with nested use of
modules that contain equivalence statements. Tested on x86-64-linux.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60780
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40958
2015-05-14
PR fortran 60780
* module.c (load_equiv) : add check for duplicate modules
Index: module.c
===================================================================
--- module.c (revision 223202)
+++ module.c (working copy)
@@ -4479,8 +4479,8 @@
static void
load_equiv (void)
{
- gfc_equiv *head, *tail, *end, *eq;
- bool unused;
+ gfc_equiv *head, *tail, *end, *eq, *equiv;
+ bool unused, duplicate;
mio_lparen ();
in_load_equiv = true;
@@ -4523,8 +4523,20 @@
}
}
- if (unused)
+ /* Check for duplicate equivalences being loaded from different
modules */
+ duplicate = false;
+ for (equiv = gfc_current_ns->equiv; equiv; equiv = equiv->next)
{
+ if (equiv->module && head->module
+ && strcmp (equiv->module, head->module) == 0)
+ {
+ duplicate = true;
+ break;
+ }
+ }
+
+ if (unused || duplicate)
+ {
for (eq = head; eq; eq = head)
{
head = eq->eq;