+2018-02-10 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/84141
+ PR fortran/84155
+ * trans-array.c (gfc_array_init_size): Revert the change made
+ in revision 257356 setting the dtype.
+ * trans-types.c (gfc_get_dtype): Do not use the cached dtype.
+ Call gfc_get_dtype_rank_type every time.
+
+ PR fortran/56691
+ * trans-array.c (gfc_conv_expr_descriptor): If the source array
+ is a descriptor type, use its offset, removing the condition
+ that is be a class expression.
+
2018-02-07 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/82994
}
else
{
- tmp = gfc_get_dtype_rank_type (rank, gfc_get_element_type (type));
- gfc_add_modify (pblock, gfc_conv_descriptor_dtype (descriptor), tmp);
+ tmp = gfc_conv_descriptor_dtype (descriptor);
+ gfc_add_modify (pblock, tmp, gfc_get_dtype (type));
}
or_expr = logical_false_node;
: base;
gfc_conv_descriptor_offset_set (&loop.pre, parm, tmp);
}
- else if (IS_CLASS_ARRAY (expr) && !se->data_not_needed
- && (!rank_remap || se->use_offset)
- && GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc)))
+ else if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc))
+ && !se->data_not_needed
+ && (!rank_remap || se->use_offset))
{
gfc_conv_descriptor_offset_set (&loop.pre, parm,
gfc_conv_descriptor_offset_get (desc));
gcc_assert (GFC_DESCRIPTOR_TYPE_P (type) || GFC_ARRAY_TYPE_P (type));
- if (GFC_TYPE_ARRAY_DTYPE (type))
- return GFC_TYPE_ARRAY_DTYPE (type);
-
rank = GFC_TYPE_ARRAY_RANK (type);
etype = gfc_get_element_type (type);
dtype = gfc_get_dtype_rank_type (rank, etype);
+2018-02-10 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/56691
+ * gfortran.dg/type_to_class_4.f03: New test.
+
2018-02-10 Alan Modra <amodra@gmail.com>
PR target/84300
--- /dev/null
+! { dg-do run }
+!
+! Test the fix for PR56691 comment #7 (and comment #0).
+!
+! Reduced from the original of Marco Restelli <mrestelli@gmail.com>
+! by Janus Weil <janus@gcc.gnu.org>
+!
+module m2
+ implicit none
+ type :: t_stv
+ real :: f1
+ end type
+contains
+ subroutine lcb(y)
+ class(t_stv), intent(in) :: y(:)
+ integer :: k
+ do k=1,size(y)
+ if (int(y(k)%f1) .ne. k) call abort
+ enddo
+ end subroutine
+end module
+
+program test
+ use m2
+ implicit none
+
+ type(t_stv), allocatable :: work(:)
+
+ allocate(work(4))
+ work(:)%f1 = (/ 1.,2.,3.,4./)
+
+ call lcb(work)
+ call lcb(work(:4)) ! Indexing used to be offset by 1.
+
+end program