http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48059
Michael Matz <matz at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |matz at gcc dot gnu.org
--- Comment #6 from Michael Matz <matz at gcc dot gnu.org> 2011-03-11 13:35:04
UTC ---
Without the assert it tries to generate this code:
struct __class_a_module_B_type * D.1572;
D.1572 = (struct __class_a_module_B_type *) this;
D.1574 = D.1572->_data->length;
It's the forming of _data->length that is wrong. That is because
_data is of type b_type, and that one doesn't have a 'length' member.
It only has a a_type member, and _that_ one has length. So, what it
should have generated is:
D.1574 = D.1572->_data->a_type.length;
I think the inputs to conv_parent_component_references are already wrong.
>From the caller of that function (gfc_conv_variable):
755 case REF_COMPONENT:
756 if (ref->u.c.sym->attr.extension)
757>>> conv_parent_component_references (se, ref);
758
759 gfc_conv_component_ref (se, ref);
(gdb) p debug_generic_expr(se->expr)
*D.1572
(That's the b_type variable)
(gdb) p ref->u.c.sym->name
$55 = 0x7ffff7f47b28 "__class_a_module_A_type"
(gdb) p ref->u.c.component->name
$56 = 0x7ffff7e7ffa0 "length"
So, it wants to get at the a_type.length member, but applies the whole
thing to a b_type'd variable. That's not what conv_parent_component_references
is supposed to fix up. I don't know
enough about fortrans OOP implementation to suggest where this is supposed
to be fixed up.