This is the mail archive of the gcc-patches@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] |
changelog and patch attached. --bud
Index: gcc/gcc/fortran/module.c =================================================================== --- gcc/gcc/fortran/module.c (revision 112482) +++ gcc/gcc/fortran/module.c (working copy) @@ -3052,26 +3052,27 @@ } /* Recursive function to traverse the pointer_info tree and load a - needed symbol. We return nonzero if we load a symbol and stop the - traversal, because the act of loading can alter the tree. */ + needed symbol. Because the act of loading can alter the tree, we + keep a count of all possible symbols to deal with. */ -static int -load_needed (pointer_info * p) +static void +load_needed (pointer_info * p, int * symbols_remaining) { 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; + return ; + load_needed (p->left, symbols_remaining); + load_needed (p->right, symbols_remaining); + if (p->type != P_SYMBOL || p->u.rsym.state != NEEDED) - return 0; + return ; + (*symbols_remaining)++; + p->u.rsym.state = USED; set_module_locus (&p->u.rsym.where); @@ -3101,7 +3102,7 @@ mio_symbol (sym); sym->attr.use_assoc = 1; - return 1; + return ; } @@ -3155,6 +3156,7 @@ gfc_use_rename *u; gfc_symtree *st; gfc_symbol *sym; + int symbols_remaining; get_module_locus (&operator_interfaces); /* Skip these for now */ skip_list (); @@ -3323,7 +3325,12 @@ been loaded yet. If one symbol requires another, the other gets marked as NEEDED if its previous state was UNUSED. */ - while (load_needed (pi_root)); + do + { + symbols_remaining = 0; + load_needed (pi_root, &symbols_remaining); + } + while (symbols_remaining > 0); /* Make sure all elements of the rename-list were found in the module. */
Attachment:
cl
Description: 3601903008-cl
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |