This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/44556] incorrect error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement
- From: "kargl at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jun 2010 19:08:11 -0000
- Subject: [Bug fortran/44556] incorrect error: Stat-variable at (1) shall not be DEALLOCATEd within the same DEALLOCATE statement
- References: <bug-44556-19334@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from kargl at gcc dot gnu dot org 2010-06-17 19:08 -------
The following patch restores the 4.4.0 behavior for
STAT of not checking derived type components. This
of course now allows invalid code to compile such as
this modified version of OP's test subroutine
subroutine test
type(test_type) :: foo
deallocate(foo%array, stat=foo%array(1))
end subroutine test
Index: resolve.c
===================================================================
--- resolve.c (revision 160935)
+++ resolve.c (working copy)
@@ -6588,7 +6588,8 @@ resolve_allocate_deallocate (gfc_code *c
"variable", &stat->where);
for (p = code->ext.alloc.list; p; p = p->next)
- if (p->expr->symtree->n.sym->name == stat->symtree->n.sym->name)
+ if (stat->symtree->n.sym->ts.type != BT_DERIVED
+ && p->expr->symtree->n.sym->name == stat->symtree->n.sym->name)
gfc_error ("Stat-variable at %L shall not be %sd within "
"the same %s statement", &stat->where, fcn, fcn);
}
@@ -6617,7 +6618,8 @@ resolve_allocate_deallocate (gfc_code *c
"variable", &errmsg->where);
for (p = code->ext.alloc.list; p; p = p->next)
- if (p->expr->symtree->n.sym->name == errmsg->symtree->n.sym->name)
+ if (errmsg->symtree->n.sym->ts.type != BT_DERIVED
+ && p->expr->symtree->n.sym->name == errmsg->symtree->n.sym->name)
gfc_error ("Errmsg-variable at %L shall not be %sd within "
"the same %s statement", &errmsg->where, fcn, fcn);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44556