http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56575



Thomas Koenig <tkoenig at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

                 CC|                            |tkoenig at gcc dot gnu.org



--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-03-09 
13:34:33 UTC ---

The problem is that ts.u.derived->components is NULL.



Program received signal SIGSEGV, Segmentation fault.

0x00000000005394b6 in gfc_default_initializer (ts=0x160bf30) at

../../trunk/gcc/fortran/expr.c:3889

3889            || (comp->ts.type == BT_CLASS && CLASS_DATA

(comp)->attr.allocatable))

(gdb) p comp->ts.type

$1 = BT_CLASS

(gdb) p comp->ts.u.derived->components

$2 = (gfc_component *) 0x0

(gdb) 



This patch looks useful:



Index: expr.c

===================================================================

--- expr.c      (Revision 195922)

+++ expr.c      (Arbeitskopie)

@@ -3886,7 +3886,8 @@

      types (otherwise we could use gfc_has_default_initializer()).  */

   for (comp = ts->u.derived->components; comp; comp = comp->next)

     if (comp->initializer || comp->attr.allocatable

-       || (comp->ts.type == BT_CLASS && CLASS_DATA (comp)->attr.allocatable))

+       || (comp->ts.type == BT_CLASS 

+           && comp->attr.class_ok && CLASS_DATA (comp)->attr.allocatable))

       break;



   if (!comp)



I'll give it a regtest.

Reply via email to