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/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one



------- Comment #1 from burnus at gcc dot gnu dot org  2007-07-30 15:45 -------
The problem is that "all_res" is not only the name of a (result) variable but
also of the function itself.

The following - not regtested - should work (also if one uses ENTRY rather than
FUNCTION).

Index: gcc/fortran/match.c
===================================================================
--- gcc/fortran/match.c (Revision 127062)
+++ gcc/fortran/match.c (Arbeitskopie)
@@ -2015,7 +2015,9 @@ gfc_match_allocate (void)
          goto cleanup;
        }

-      if (stat->symtree->n.sym->attr.flavor != FL_VARIABLE)
+      if (stat->symtree->n.sym->attr.flavor != FL_VARIABLE
+         && (!stat->symtree->n.sym->attr.function
+             || stat->symtree->n.sym->result != stat->symtree->n.sym))
        {
          gfc_error ("STAT expression at %C must be a variable");
          goto cleanup;


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
      Known to fail|                            |4.3.0 4.2.2 4.1.3
   Last reconfirmed|0000-00-00 00:00:00         |2007-07-30 15:45:12
               date|                            |
            Summary|Error: STAT expression ...  |ALLOCATE: "STAT expression
                   |must be a variable - but it |... must be a variable" -
                   |is                          |but it is one


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


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