[Bug fortran/46408] [OOP] Segfault when running gfortran.dg/class_allocate_6.f03
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jan 2 16:24:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46408
--- Comment #5 from janus at gcc dot gnu.org 2011-01-02 16:24:00 UTC ---
(In reply to comment #4)
> x%a should get default-initialized to NULL via the memcpy call from
> x._vptr->_def_init. The memcpy itself is done alright, but apparently the
> _def_init variable is not properly initialized (is it?):
>
> static struct t2 __def_init_MAIN___t2 = {};
No, it's not. The problem is: __def_init_MAIN___t2 is declared as SAVE in
gfc_find_derived_vtab. Therefore it's allocatable components do not get
default-initialized to NULL. However, if we don't give it the SAVE attribute,
we get:
Error: Pointer initialization target at (1) must have the SAVE attribute
Because the def_init symbol is used as pointer init target for the vtab.
:(
More information about the Gcc-bugs
mailing list