public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran] fix for PR 60780, PR 40958
@ 2015-05-15  4:36 Russell Whitesides
  2015-05-15  4:39 ` Steve Kargl
  0 siblings, 1 reply; 6+ messages in thread
From: Russell Whitesides @ 2015-05-15  4:36 UTC (permalink / raw)
  To: fortran, gcc-patches

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;

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-05-15 16:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-15  4:36 [patch, fortran] fix for PR 60780, PR 40958 Russell Whitesides
2015-05-15  4:39 ` Steve Kargl
2015-05-15  4:51   ` Russell Whitesides
2015-05-15  5:00     ` Steve Kargl
2015-05-15 11:09       ` FX
2015-05-15 16:58         ` russelldub .

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).