summaryrefslogtreecommitdiff
path: root/libgfortran/generated
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-21 12:25:12 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-21 12:25:12 +0000
commita15e7290fcfa878968fbd0c9fefdffc49e69b1d1 (patch)
tree1e94c7cd4fa400c87e7f43094060b274a34ad669 /libgfortran/generated
parentf3efaadaf83c4db4dc0bcf1e93b7050c5eeba890 (diff)
downloadgcc-a15e7290fcfa878968fbd0c9fefdffc49e69b1d1.tar.gz
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-21 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/46007 * gfortran.dg/shape_5.f90: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165770 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/generated')
-rw-r--r--libgfortran/generated/shape_i16.c12
-rw-r--r--libgfortran/generated/shape_i4.c12
-rw-r--r--libgfortran/generated/shape_i8.c12
3 files changed, 33 insertions, 3 deletions
diff --git a/libgfortran/generated/shape_i16.c b/libgfortran/generated/shape_i16.c
index 9ce28577baa..c2c52005a13 100644
--- a/libgfortran/generated/shape_i16.c
+++ b/libgfortran/generated/shape_i16.c
@@ -41,13 +41,23 @@ shape_16 (gfc_array_i16 * const restrict ret,
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 ;
diff --git a/libgfortran/generated/shape_i4.c b/libgfortran/generated/shape_i4.c
index 1b23335de56..0cef3327736 100644
--- a/libgfortran/generated/shape_i4.c
+++ b/libgfortran/generated/shape_i4.c
@@ -41,13 +41,23 @@ shape_4 (gfc_array_i4 * const restrict ret,
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 ;
diff --git a/libgfortran/generated/shape_i8.c b/libgfortran/generated/shape_i8.c
index efe00a5dd33..b457ae081c7 100644
--- a/libgfortran/generated/shape_i8.c
+++ b/libgfortran/generated/shape_i8.c
@@ -41,13 +41,23 @@ shape_8 (gfc_array_i8 * const restrict ret,
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 ;