Commit 02139671 by Tobias Burnus Committed by Tobias Burnus

re PR fortran/51383 ([OOP] arrays of extended types break when associated)

2011-12-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51383
        * resolve.c (find_array_spec): Use ref->u.c.component
        directly without starting from ts.u.derived.

2011-12-04  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51383
        * gfortran.dg/associate_10.f90: New.

From-SVN: r181992
parent 8f90394a
2011-12-04 Tobias Burnus <burnus@net-b.de>
PR fortran/51383
* resolve.c (find_array_spec): Use ref->u.c.component
directly without starting from ts.u.derived.
2011-12-03 Tobias Burnus <burnus@net-b.de> 2011-12-03 Tobias Burnus <burnus@net-b.de>
PR fortran/48887 PR fortran/48887
......
...@@ -4515,14 +4515,12 @@ find_array_spec (gfc_expr *e) ...@@ -4515,14 +4515,12 @@ find_array_spec (gfc_expr *e)
{ {
gfc_array_spec *as; gfc_array_spec *as;
gfc_component *c; gfc_component *c;
gfc_symbol *derived;
gfc_ref *ref; gfc_ref *ref;
if (e->symtree->n.sym->ts.type == BT_CLASS) if (e->symtree->n.sym->ts.type == BT_CLASS)
as = CLASS_DATA (e->symtree->n.sym)->as; as = CLASS_DATA (e->symtree->n.sym)->as;
else else
as = e->symtree->n.sym->as; as = e->symtree->n.sym->as;
derived = NULL;
for (ref = e->ref; ref; ref = ref->next) for (ref = e->ref; ref; ref = ref->next)
switch (ref->type) switch (ref->type)
...@@ -4536,26 +4534,7 @@ find_array_spec (gfc_expr *e) ...@@ -4536,26 +4534,7 @@ find_array_spec (gfc_expr *e)
break; break;
case REF_COMPONENT: case REF_COMPONENT:
if (derived == NULL) c = ref->u.c.component;
derived = e->symtree->n.sym->ts.u.derived;
if (derived->attr.is_class)
derived = derived->components->ts.u.derived;
c = derived->components;
for (; c; c = c->next)
if (c == ref->u.c.component)
{
/* Track the sequence of component references. */
if (c->ts.type == BT_DERIVED)
derived = c->ts.u.derived;
break;
}
if (c == NULL)
gfc_internal_error ("find_array_spec(): Component not found");
if (c->attr.dimension) if (c->attr.dimension)
{ {
if (as != NULL) if (as != NULL)
......
2011-12-04 Tobias Burnus <burnus@net-b.de>
PR fortran/51383
* gfortran.dg/associate_10.f90: New.
2011-12-04 Ira Rosen <ira.rosen@linaro.org> 2011-12-04 Ira Rosen <ira.rosen@linaro.org>
PR middle-end/51285 PR middle-end/51285
......
! { dg-do compile }
!
! PR fortran/51383
!
! Contributed by kaiserkarl31@yahoo.com
!
! Was failing before at the ref resolution of y1(1)%i.
!
program extend
type :: a
integer :: i
end type a
type, extends (a) :: b
integer :: j
end type b
type (a) :: x(2)
type (b) :: y(2)
associate (x1 => x, y1 => y)
x1(1)%i = 1
! Commenting out the following line will avoid the error
y1(1)%i = 2
end associate
end program extend
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment