re PR fortran/47463 ([OOP] ICE in gfc_add_component_ref)
authorJanus Weil <janus@gcc.gnu.org>
Wed, 9 Feb 2011 20:30:20 +0000 (21:30 +0100)
committerJanus Weil <janus@gcc.gnu.org>
Wed, 9 Feb 2011 20:30:20 +0000 (21:30 +0100)
2011-02-09  Janus Weil  <janus@gcc.gnu.org>

PR fortran/47463
* resolve.c (resolve_typebound_subroutine): Remove erroneous line.

2011-02-09  Janus Weil  <janus@gcc.gnu.org>

PR fortran/47463
* gfortran.dg/typebound_assignment_2.f03: New.

From-SVN: r169985

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/typebound_assignment_2.f03 [new file with mode: 0644]

index 14ae30f..6475d5e 100644 (file)
@@ -1,5 +1,10 @@
 2011-02-09  Janus Weil  <janus@gcc.gnu.org>
 
+       PR fortran/47463
+       * resolve.c (resolve_typebound_subroutine): Remove erroneous line.
+
+2011-02-09  Janus Weil  <janus@gcc.gnu.org>
+
        PR fortran/47637
        * trans-decl.c (init_intent_out_dt): Handle CLASS arguments.
 
index 7f3734e..688967a 100644 (file)
@@ -5894,7 +5894,6 @@ resolve_typebound_subroutine (gfc_code *code)
       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);
       code->expr1->value.function.esym = NULL;
index 8f26a77..9725a49 100644 (file)
@@ -1,3 +1,8 @@
+2011-02-09  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/47463
+       * gfortran.dg/typebound_assignment_2.f03: New.
+
 2011-02-09  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/47664
diff --git a/gcc/testsuite/gfortran.dg/typebound_assignment_2.f03 b/gcc/testsuite/gfortran.dg/typebound_assignment_2.f03
new file mode 100644 (file)
index 0000000..862535a
--- /dev/null
@@ -0,0 +1,39 @@
+! { dg-do compile }
+!
+! PR 47463: [OOP] ICE in gfc_add_component_ref
+!
+! Contributed by Rich Townsend <townsend@astro.wisc.edu>
+
+module hydro_grid
+  type :: grid_t
+   contains
+     procedure :: assign
+     generic   :: assignment(=) => assign
+  end type grid_t
+  public :: grid_t
+contains
+  subroutine assign (this, that)
+    class(grid_t), intent(inout) :: this
+    class(grid_t), intent(in)    :: that
+  end subroutine assign
+end module hydro_grid
+
+module hydro_flow
+  use hydro_grid
+  type :: flow_t
+     class(grid_t), allocatable  :: gr
+  end type flow_t
+contains
+  subroutine init_params (this)
+    class(flow_t), intent(out) :: this
+    type(grid_t)               :: gr
+   call init_comps(this, gr)
+  end subroutine init_params
+  subroutine init_comps (this, gr)
+    class(flow_t), intent(out) :: this
+    class(grid_t), intent(in)  :: gr
+    this%gr = gr
+  end subroutine init_comps
+end module hydro_flow 
+
+! { dg-final { cleanup-modules "hydro_grid hydro_flow" } }