This is the mail archive of the gcc-bugs@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]

[Bug fortran/33818] [4.3 Regression] Bogus error "Variable 'str' is used at (1) before the ENTRY statement"



------- Comment #4 from burnus at gcc dot gnu dot org  2007-10-19 21:16 -------
I'm not completely sure which bug is triggered that, but the error occurs for
the expression
   character(len(str))     :: UpperCase

"str" is a dummy (of the interface function UpperCase) and despite being a
dummy it is not a dummy of the current entry function (which is "ExportZMX").

The check assumes: Dummy + not-dummy of current function => Dummy of another
Entry -> invalid.

The solution is to add a check whether the dummy in in the current name space
or not.

I could not find any bit in the patches which caused this, but my un-educated
guess would be http://gcc.gnu.org/viewcvs?view=rev&revision=127939 which added
some character substring fixes.

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 129495)
+++ gcc/fortran/resolve.c       (working copy)
@@ -3935,7 +3935,7 @@ resolve_variable (gfc_expr *e)
       bool seen;

       /* If the symbol is a dummy...  */
-      if (sym->attr.dummy)
+      if (sym->attr.dummy && sym->ns == gfc_current_ns)
        {
          entry = gfc_current_ns->entries;
          seen = false;
@@ -3952,7 +3952,7 @@ resolve_variable (gfc_expr *e)
          if (!seen)
            {
              if (specification_expr)
-               gfc_error ("Variable '%s',used in a specification expression, "
+               gfc_error ("Variable '%s', used in a specification expression,
"
                           "is referenced at %L before the ENTRY statement "
                           "in which it is a parameter",
                           sym->name, &cs_base->current->loc);


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33818


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