re PR fortran/47463 ([OOP] ICE in gfc_add_component_ref)
2011-01-31 Janus Weil <janus@gcc.gnu.org> PR fortran/47463 * resolve.c (resolve_typebound_subroutine): Bug fix for the case of an argument of a typebound assignment being a component. 2011-01-31 Janus Weil <janus@gcc.gnu.org> PR fortran/47463 * gfortran.dg/typebound_assignment_1.f03: New. From-SVN: r169443
This commit is contained in:
parent
0425d6f563
commit
b6c77bcb57
4 changed files with 49 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2011-01-31 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/47463
|
||||
* resolve.c (resolve_typebound_subroutine): Bug fix for the case of
|
||||
an argument of a typebound assignment being a component.
|
||||
|
||||
2011-01-31 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
* gfortranspec.c (add_arg_libgfortran) [HAVE_LD_STATIC_DYNAMIC] Use
|
||||
|
|
|
@ -5877,14 +5877,12 @@ resolve_typebound_subroutine (gfc_code *code)
|
|||
|
||||
/* Deal with typebound operators for CLASS objects. */
|
||||
expr = code->expr1->value.compcall.base_object;
|
||||
if (expr && expr->symtree->n.sym->ts.type == BT_CLASS
|
||||
&& code->expr1->value.compcall.name)
|
||||
if (expr && expr->ts.type == BT_CLASS && code->expr1->value.compcall.name)
|
||||
{
|
||||
/* Since the typebound operators are generic, we have to ensure
|
||||
that any delays in resolution are corrected and that the vtab
|
||||
is present. */
|
||||
ts = expr->symtree->n.sym->ts;
|
||||
declared = ts.u.derived;
|
||||
declared = expr->ts.u.derived;
|
||||
c = gfc_find_component (declared, "_vptr", true, true);
|
||||
if (c->ts.u.derived == NULL)
|
||||
c->ts.u.derived = gfc_find_derived_vtab (declared);
|
||||
|
@ -5895,6 +5893,7 @@ resolve_typebound_subroutine (gfc_code *code)
|
|||
/* Use the generic name if it is there. */
|
||||
name = name ? name : code->expr1->value.function.esym->name;
|
||||
code->expr1->symtree = expr->symtree;
|
||||
code->expr1->ref = gfc_copy_ref (expr->ref);
|
||||
expr->symtree->n.sym->ts.u.derived = declared;
|
||||
gfc_add_vptr_component (code->expr1);
|
||||
gfc_add_component_ref (code->expr1, name);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2011-01-31 Janus Weil <janus@gcc.gnu.org>
|
||||
|
||||
PR fortran/47463
|
||||
* gfortran.dg/typebound_assignment_1.f03: New.
|
||||
|
||||
2011-01-31 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/47538
|
||||
|
|
35
gcc/testsuite/gfortran.dg/typebound_assignment_1.f03
Normal file
35
gcc/testsuite/gfortran.dg/typebound_assignment_1.f03
Normal file
|
@ -0,0 +1,35 @@
|
|||
! { dg-do compile }
|
||||
!
|
||||
! PR 47463: [OOP] ICE in gfc_add_component_ref
|
||||
!
|
||||
! Contributed by Rich Townsend <townsend@astro.wisc.edu>
|
||||
|
||||
module hydro_state
|
||||
type :: state_t
|
||||
contains
|
||||
procedure :: assign
|
||||
generic :: assignment(=) => assign
|
||||
end type state_t
|
||||
contains
|
||||
subroutine assign (this, that)
|
||||
class(state_t), intent(inout) :: this
|
||||
class(state_t), intent(in) :: that
|
||||
end subroutine assign
|
||||
end module hydro_state
|
||||
|
||||
module hydro_flow
|
||||
use hydro_state
|
||||
type :: flow_t
|
||||
class(state_t), allocatable :: st
|
||||
end type flow_t
|
||||
contains
|
||||
subroutine init_comps (this, st)
|
||||
class(flow_t), intent(out) :: this
|
||||
class(state_t), intent(in) :: st
|
||||
|
||||
allocate(state_t :: this%st)
|
||||
this%st = st
|
||||
end subroutine init_comps
|
||||
end module hydro_flow
|
||||
|
||||
! { dg-final { cleanup-modules "hydro_state hydro_flow" } }
|
Loading…
Add table
Reference in a new issue