Commit d233ee5f by Paul Thomas

re PR fortran/67564 (Segfault on sourced allocattion statement with class(*) arrays)

2016-11-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/67564
	* trans-expr.c (gfc_conv_class_to_class): Return _len component
	of unlimited polymorphic entities.

2016-11-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/67564
	* gfortran.dg/select_type_39.f03: New test.

From-SVN: r241869
parent 655a8355
2016-04-19 Paul Thomas <pault@gcc.gnu.org>
2016-11-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/67564
* trans-expr.c (gfc_conv_class_to_class): Return _len component
of unlimited polymorphic entities.
2016-11-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/64933
* primary.c (gfc_match_varspec): If selector expression is
......
......@@ -1091,6 +1091,12 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts,
tmp = integer_zero_node;
gfc_add_modify (&parmse->pre, ctree,
fold_convert (TREE_TYPE (ctree), tmp));
/* Return the len component, except in the case of scalarized array
references, where the dynamic type cannot change. */
if (!elemental && full_array && copyback)
gfc_add_modify (&parmse->post, tmp,
fold_convert (TREE_TYPE (tmp), ctree));
}
if (optional)
......
2016-04-19 Paul Thomas <pault@gcc.gnu.org>
2016-11-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/67564
* gfortran.dg/select_type_39.f03: New test.
2016-11-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/64933
* gfortran.dg/associate_23.f90: New test.
......
! { dg-do run }
!
! Tests the fix for PR67564 comment #9.
!
! Contributed by Neil Carlson <neil.n.carlson@gmail.com>
!
class(*), allocatable :: val(:)
call get_value (val)
select type (val)
type is (character(*))
if (size (val) .ne. 2) call abort
if (len(val) .ne. 3) call abort
if (any (val .ne. ['foo','bar'])) call abort
end select
contains
subroutine get_value (value)
class(*), allocatable, intent(out) :: value(:)
allocate(value, source=['foo','bar'])
end subroutine
end
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