+2010-10-21 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/46007
+ * gfortran.dg/shape_5.f90: New test case.
+
2010-10-21 Janus Weil <janus@gcc.gnu.org>
PR fortran/46060
--- /dev/null
+! { dg-do run }
+! PR 40067 - this used to segfault on an unallocated return array.
+ integer, dimension(10) :: int1d
+ integer, dimension(:), pointer :: int1d_retrieved
+
+ allocate(int1d_retrieved(10))
+ if (any(shape(int1d_retrieved) /= shape(INT1D))) call abort()
+ end
+2010-10-21 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/46007
+ * m4/shape.m4 (shape_'rtype_kind`): Use variable for rank.
+ Allocate return array if unallocated.
+ * generated/shape_i4.c: Regenerated.
+ * generated/shape_i8.c: Regenerated.
+ * generated/shape_i16.c: Regenerated.
+
2010-10-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/46079
int n;
index_type stride;
index_type extent;
+ int rank;
+
+ rank = GFC_DESCRIPTOR_RANK (array);
+
+ if (ret->data == NULL)
+ {
+ GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
+ ret->offset = 0;
+ ret->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+ }
stride = GFC_DESCRIPTOR_STRIDE(ret,0);
if (GFC_DESCRIPTOR_EXTENT(ret,0) < 1)
return;
- for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)
+ for (n = 0; n < rank; n++)
{
extent = GFC_DESCRIPTOR_EXTENT(array,n);
ret->data[n * stride] = extent > 0 ? extent : 0 ;
int n;
index_type stride;
index_type extent;
+ int rank;
+
+ rank = GFC_DESCRIPTOR_RANK (array);
+
+ if (ret->data == NULL)
+ {
+ GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
+ ret->offset = 0;
+ ret->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+ }
stride = GFC_DESCRIPTOR_STRIDE(ret,0);
if (GFC_DESCRIPTOR_EXTENT(ret,0) < 1)
return;
- for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)
+ for (n = 0; n < rank; n++)
{
extent = GFC_DESCRIPTOR_EXTENT(array,n);
ret->data[n * stride] = extent > 0 ? extent : 0 ;
int n;
index_type stride;
index_type extent;
+ int rank;
+
+ rank = GFC_DESCRIPTOR_RANK (array);
+
+ if (ret->data == NULL)
+ {
+ GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
+ ret->offset = 0;
+ ret->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+ }
stride = GFC_DESCRIPTOR_STRIDE(ret,0);
if (GFC_DESCRIPTOR_EXTENT(ret,0) < 1)
return;
- for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)
+ for (n = 0; n < rank; n++)
{
extent = GFC_DESCRIPTOR_EXTENT(array,n);
ret->data[n * stride] = extent > 0 ? extent : 0 ;
int n;
index_type stride;
index_type extent;
+ int rank;
+
+ rank = GFC_DESCRIPTOR_RANK (array);
+
+ if (ret->data == NULL)
+ {
+ GFC_DIMENSION_SET(ret->dim[0], 0, rank - 1, 1);
+ ret->offset = 0;
+ ret->data = internal_malloc_size (sizeof ('rtype_name`) * rank);
+ }
stride = GFC_DESCRIPTOR_STRIDE(ret,0);
if (GFC_DESCRIPTOR_EXTENT(ret,0) < 1)
return;
- for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)
+ for (n = 0; n < rank; n++)
{
extent = GFC_DESCRIPTOR_EXTENT(array,n);
ret->data[n * stride] = extent > 0 ? extent : 0 ;