The compiler warns that in the function "resolve_function" of resolve.c:, the variable "name" might be used unintialized. I think gcc is right. Name is initialized with: if (!pure_function (expr, &name) && name) and later used without extra if(name) in: if (expr->value.function.esym && !expr->value.function.esym->attr.recursive) { gfc_symbol *esym, *proc; esym = expr->value.function.esym; proc = gfc_current_ns->proc_name; if (esym == proc) { gfc_error ("Function '%s' at %L cannot call itself, as it is not " "RECURSIVE", name, &expr->where); t = FAILURE; } if (esym->attr.entry && esym->ns->entries && proc->ns->entries && esym->ns->entries->sym == proc->ns->entries->sym) { gfc_error ("Call to ENTRY '%s' at %L is recursive, but function " "'%s' is not declared as RECURSIVE", esym->name, &expr->where, esym->ns->entries->sym->name); t = FAILURE; } }
Can you try after: http://gcc.gnu.org/ml/gcc-cvs/2007-01/msg00765.html ? >and later used without extra if(name) in: No, that means it is used possiable as null. You need to check inside pure_function to see if there is a way that the second argument does not get initialized.
> No, that means it is used possiable as null. > You need to check inside pure_function to see if there is a way that the > second argument does not get initialized. There is: if (e->symtree != NULL && e->symtree->n.sym != NULL && e->symtree->n.sym->attr.proc == PROC_ST_FUNCTION) return 1; One could thus either add a line in pure_function or in "resolve_function" to set name to null. Or in both. Having it in "resolve_function" means we get rid of this warning.
(In reply to comment #2) > > No, that means it is used possiable as null. > > You need to check inside pure_function to see if there is a way that the > > second argument does not get initialized. > > There is: > if (e->symtree != NULL > && e->symtree->n.sym != NULL > && e->symtree->n.sym->attr.proc == PROC_ST_FUNCTION) > return 1; > > One could thus either add a line in pure_function or in "resolve_function" to > set name to null. Or in both. Having it in "resolve_function" means we get rid > of this warning. > No, it must be if (e->symtree != NULL && e->symtree->n.sym != NULL && e->symtree->n.sym->attr.proc == PROC_ST_FUNCTION) { *name = e->symtree->n.sym->name; return 1; } for consistency. Paul PS That was my doing, so will fix as obvious.
Subject: Bug 30549 Author: pault Date: Tue Jan 23 07:19:26 2007 New Revision: 121080 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121080 Log: 2007-01-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/30549 * resolve.c (pure_function): Add return of name for state- ment functions.. Modified: branches/gcc-4_2-branch/gcc/fortran/ChangeLog branches/gcc-4_2-branch/gcc/fortran/resolve.c
fortran seems to bootstrap now.