Question to gfc_match_structure_constructor and gfc_find_component

Tobias Burnus burnus@net-b.de
Thu May 6 06:15:00 GMT 2010


Hi all, hi Daniel,

I have a question regarind the call to gfc_find_component in 
gfc_match_structure_constructor. If I look at the call, I have no idea
what it should do - it looks like a complicatedly written no-op.

(diff = commit on 2008-08-25):
+++ b/gcc/fortran/primary.c
@@ -2096,7 +2096,7 @@ gfc_match_structure_constructor (gfc_symbol *sym,
gfc_expr **result, bool parent
 
   where = gfc_current_locus;
 
-  gfc_find_component (sym, NULL);
+  gfc_find_component (sym, NULL, false, true);


What is the purpose of the call? The function returns gfc_component, but
that's not used. It does some checking - but it is not printed for
silent=true; and "sym" is also not modified, unless I have overlooked
something. Thus: What is the purpose of the call?

The prototype of the call is (symbol.c):

 /* Given a derived type node and a component name, try to locate the
    component structure.  Returns the NULL pointer if the component is
-   not found or the components are private.  */
+   not found or the components are private.  If noaccess is set, no access
+   checks are done.  */
 
 gfc_component *
-gfc_find_component (gfc_symbol *sym, const char *name)
+gfc_find_component (gfc_symbol *sym, const char *name,
+                   bool noaccess, bool silent)


Tobias



More information about the Fortran mailing list