gfc_add_data_component (arg_expr);
gfc_conv_expr_reference (se, arg_expr);
}
- else
+ else if (gfc_is_simply_contiguous (arg_expr, false, false))
gfc_conv_array_parameter (se, arg_expr, true, NULL, NULL, NULL);
+ else
+ {
+ gfc_conv_expr_descriptor (se, arg_expr);
+ se->expr = gfc_conv_descriptor_data_get (se->expr);
+ }
se->expr = convert (gfc_get_int_type (gfc_index_integer_kind), se->expr);
+ se->expr = gfc_evaluate_now (se->expr, &se->pre);
/* Create a temporary variable for loc return value. Without this,
we get an error an ICE in gcc/expr.cc(expand_expr_addr_expr_1). */
--- /dev/null
+! { dg-do compile }
+! { dg-additional-options "-O1" }
+!
+! PR fortran/125606
+!
+! Derived from Fujitsu testsuite
+! Reported by David Binderman
+
+module m
+ implicit none
+ type ty
+ class(*), allocatable :: c1(:)
+ end type ty
+ type tt
+ class(*), allocatable :: node1(:)
+ end type tt
+ type,extends(tt)::tte
+ class(*), allocatable :: c2e(:)
+ end type tte
+contains
+ subroutine put_addr
+ class(*), allocatable :: t(:)
+ integer :: unit
+ select type (t)
+ class is (tt)
+ select type (p=>t(2)%node1)
+ class is (ty)
+ write (unit) loc(p(2)%c1)
+ end select
+ select type (t)
+ type is (tte)
+ write (7) loc(t(2)%c2e)
+ end select
+ end select
+ end subroutine put_addr
+end module m