------- 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