This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31163] SAVEd derived types with ALLOCATABLE components don't work
- 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: 13 Mar 2007 14:33:24 -0000
- Subject: [Bug fortran/31163] SAVEd derived types with ALLOCATABLE components don't work
- References: <bug-31163-9410@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from burnus at gcc dot gnu dot org 2007-03-13 14:33 -------
Andrew wrote:
--------------------------------------------------
it is obvious from the tree dump, what is going on:
static struct foo_type f_a = {};
f_a.mv.data = 0B;
So save is done correctly but allocatables in the derived type is not.
Even at the end of the function:
{
int4 D.965;
_gfortran_deallocate (f_a.mv.data, &D.965);
f_a.mv.data = 0B;
}
So it deallocates it.
-------------------------
And I wrote:
-------------------------
It seems to be related to allocatable
components as if I change them to pointers (incl. =>NULL initialization
and allocated -> associated), it works.
Pointer:
static struct foo_type f_a = {.mv={.data=0B}};
Allocatable:
static struct foo_type f_a = {};
f_a.mv.data = 0B;
That is: The 0B initialization happens always.
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |burnus at gcc dot gnu dot
| |org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2007-03-13 14:33:24
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31163