This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/46408] [OOP] Segfault when running gfortran.dg/class_allocate_6.f03


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.

:(


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]