[gfortran] patch for pr 21130 - 38822 lines of Fortran 90 takes more than 10 minutes to compile on a dual 3GHz P4 Linux box with lots of RAM

Bud Davis bdavis9659@sbcglobal.net
Thu Mar 30 12:11:00 GMT 2006


Below is the revised patch for correcting this
problem. 
This patch forces the entire tree to be traversed and
the return value to correctly reflect if all the
symbols have been dealt with. 

Tested by running make -k check-fortran with no
additional failures on i686/linux/gnu.

Compilation time of submitters code is now around 45
seconds.

Thanks to Paul Thomas for closely looking over the
initial patch and coming up with a very clean fix.


--bud


ChangeLog

2006-03-30  Paul Thomas <paulthomas2@wanadoo.fr>

        PR 21130
        * module.c (load_needed): Traverse entire tree
before returning.

 
PATCH:


Index: gcc/fortran/module.c
===================================================================
*** gcc/fortran/module.c        (revision 112441)
--- gcc/fortran/module.c        (working copy)
*************** load_needed (pointer_info * p)
*** 3061,3076 ****
    gfc_namespace *ns;
    pointer_info *q;
    gfc_symbol *sym;

    if (p == NULL)
!     return 0;
!   if (load_needed (p->left))
!     return 1;
!   if (load_needed (p->right))
!     return 1;

    if (p->type != P_SYMBOL || p->u.rsym.state !=
NEEDED)
!     return 0;

    p->u.rsym.state = USED;

--- 3061,3077 ----
    gfc_namespace *ns;
    pointer_info *q;
    gfc_symbol *sym;
+   int rv;

+   rv = 0;
    if (p == NULL)
!     return rv;
!
!   rv |= load_needed (p->left);
!   rv |= load_needed (p->right);

    if (p->type != P_SYMBOL || p->u.rsym.state !=
NEEDED)
!     return rv;

    p->u.rsym.state = USED;






More information about the Fortran mailing list