This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Jul 2007 15:45:12 -0000
- Subject: [Bug fortran/32936] ALLOCATE: "STAT expression ... must be a variable" - but it is one
- References: <bug-32936-14910@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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