+2015-01-02 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/57562
+ * expr.c (find_component_ref): Deal with extended types.
+
2015-01-02 Tobias Burnus <burnus@net-b.de>
* trans-decl.c (gfc_build_qualified_array): Fix coarray tokens
static gfc_constructor *
find_component_ref (gfc_constructor_base base, gfc_ref *ref)
{
- gfc_component *comp;
- gfc_component *pick;
+ gfc_component *pick = ref->u.c.component;
gfc_constructor *c = gfc_constructor_first (base);
- comp = ref->u.c.sym->components;
- pick = ref->u.c.component;
+ gfc_symbol *dt = ref->u.c.sym;
+ int ext = dt->attr.extension;
+
+ /* For extended types, check if the desired component is in one of the
+ * parent types. */
+ while (ext > 0 && gfc_find_component (dt->components->ts.u.derived,
+ pick->name, true, true))
+ {
+ dt = dt->components->ts.u.derived;
+ c = gfc_constructor_first (c->expr->value.constructor);
+ ext--;
+ }
+
+ gfc_component *comp = dt->components;
while (comp != pick)
{
comp = comp->next;
+2015-01-02 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/57562
+ * gfortran.dg/extends_16.f90: New.
+
2015-01-02 Tobias Burnus <burnus@net-b.de>
* gfortran.dg/coarray/caf.exp (dg-compile-aux-modules): Add.
2015-01-02 Janus Weil <janus@gcc.gnu.org>
PR fortran/60507
- * gfortran.dg/dummy_procedure_11: New.
+ * gfortran.dg/dummy_procedure_11.f90: New.
Copyright (C) 2015 Free Software Foundation, Inc.
--- /dev/null
+! { dg-do run }\r
+!\r
+! PR 57562: [OOP] ICE due to extended derived type with PARAMETER attribute\r
+!\r
+! Contributed by <helvio.vairinhos@gmail.com>\r
+\r
+ type :: Parent\r
+ integer :: member1 = 0\r
+ end type\r
+\r
+ type, extends(Parent) :: Child\r
+ integer :: member2 = 0\r
+ end type\r
+\r
+ type, extends(Child) :: Grandchild\r
+ integer :: member3 = 0\r
+ end type\r
+\r
+ type(Grandchild), parameter :: object = Grandchild(23, 42, -99)\r
+\r
+ if (object%member1 /= 23) call abort\r
+ if (object%member2 /= 42) call abort\r
+ if (object%member3 /= -99) call abort\r
+\r
+end\r