This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

[gfortran] Work around frontend bugs.


For various reasons the gfortran parser sometimes creates symbols for 
variables which don't exist. This is fairly harmless, except that things 
fall over later on when we try and create tree nodes for these incomplete 
symbols.

The proper fix would be to avoid createing/adding these symbols. Until such 
a fix appears I've worked around it by ignoring any obviously broken 
symbols.

Applied to tree-ssa branch.

Paul

2003-10-13  Paul Brook  <paul@nowt.org>

	* trans-decl.c (generate_local_decl): Don't create junk variables.

--- clean/tree-ssa/gcc/fortran/trans-decl.c
+++ gcc/gcc/fortran/trans-decl.c
@@ -1768,6 +1768,17 @@ generate_local_decl (gfc_symbol * sym)
 {
   if (sym->attr.flavor == FL_VARIABLE)
     {
+      /* TODO: The frontend sometimes creates symbols for things which 
don't
+         actually exist.  E.g. common block names and the names of formal
+	 arguments.  The latter are created while attempting to parse
+	 the argument list as a substring reference.
+
+	 The proper fix is to avoid adding these symbols in the first place.
+	 For now we hack round it by ignoring anything with an unknown type.
+       */
+      if (sym->ts.type == BT_UNKNOWN)
+	return;
+
       if (sym->attr.referenced)
         gfc_get_symbol_decl (sym);
       else if (sym->attr.dummy)

Attachment: named_args.f90
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]