+2009-10-21 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/41706
+ PR fortran/41766
+ * match.c (select_type_set_tmp): Set flavor for temporary.
+ * resolve.c (resolve_class_typebound_call): Correctly resolve actual
+ arguments.
+
2009-10-20 Paul Thomas <pault@gcc.gnu.org>
PR fortran/41706
sprintf (name, "tmp$%s", ts->u.derived->name);
gfc_get_sym_tree (name, gfc_current_ns, &tmp, false);
- tmp->n.sym->ts = *ts;
- tmp->n.sym->attr.referenced = 1;
- tmp->n.sym->attr.pointer = 1;
+ gfc_add_type (tmp->n.sym, ts, NULL);
+ gfc_set_sym_referenced (tmp->n.sym);
+ gfc_add_pointer (&tmp->n.sym->attr, NULL);
+ gfc_add_flavor (&tmp->n.sym->attr, FL_VARIABLE, name, NULL);
select_type_stack->tmp = tmp;
}
}
/* Resolve the argument expressions, */
- resolve_arg_exprs (code->ext.actual);
+ resolve_arg_exprs (code->expr1->value.compcall.actual);
/* Get the data component, which is of the declared type. */
derived = declared->components->ts.u.derived;
+2009-10-21 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/41706
+ PR fortran/41766
+ * gfortran.dg/class_9.f03: Extended test case.
+ * gfortran.dg/select_type_7.f03: New test case.
+
2009-10-20 Richard Guenther <rguenther@suse.de>
* gcc.dg/lto/20091020-3_0.c: New testcase.
procedure, nopass :: a
procedure, nopass :: b
procedure, pass :: c
+ procedure, nopass :: d
end type
contains
c = 4.*x%v
end function
+ subroutine d (x)
+ real :: x
+ if (abs(x-3.0)>1E-3) call abort()
+ end subroutine
+
subroutine s (x)
class(t) :: x
real :: r
r = x%a(x%c ()) ! failed
if (r .ne. a(c (x))) call abort
+ call x%d (x%a(1.5)) ! failed
+
end subroutine
end
--- /dev/null
+! { dg-do run }
+!
+! PR 41766: [OOP] SELECT TYPE selector as actual argument with INTENT(INOUT)
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+ implicit none
+
+ type t1
+ integer :: a
+ end type
+
+ type, extends(t1) :: t2
+ integer :: b
+ end type
+
+ class(t1),allocatable :: cp
+
+ allocate(t2 :: cp)
+
+ select type (cp)
+ type is (t2)
+ cp%a = 98
+ cp%b = 76
+ call s(cp)
+ print *,cp%a,cp%b
+ if (cp%a /= cp%b) call abort()
+ class default
+ call abort()
+ end select
+
+contains
+
+ subroutine s(f)
+ type(t2), intent(inout) :: f
+ f%a = 3
+ f%b = 3
+ end subroutine
+
+end