summaryrefslogtreecommitdiff
path: root/libgfortran/generated/maxloc1_8_r8.c
diff options
context:
space:
mode:
authortkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-09 21:38:47 +0000
committertkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-09 21:38:47 +0000
commit07ea8faa305c0b705c675fc7255da49c66c4f780 (patch)
tree25814186d85901336c2e9c7e9a89298fa18cefc7 /libgfortran/generated/maxloc1_8_r8.c
parent32fb59abe84b4491fb04818d99930a1fcc3d94aa (diff)
downloadgcc-07ea8faa305c0b705c675fc7255da49c66c4f780.tar.gz
2005-04-09 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/19106 PR libfortran/19014 * m4/ifunction.m4 (name`'rtype_qual`_'atype_code): ditto. If retarray->data is NULL (i.e. the front end does not know the rank and dimenson of the array), fill in its properties and allocate memory. Change the assertions about rank and dimension of retarray into runtime errors and only check them for retarray->data != NULL. Do the same for correcting the stride from 0 to 1 in retarray. (`m'name`'rtype_qual`_'atype_code): Likewise. * m4/iforeach.m4 (name`'rtype_qual`_'atype_code): Likewise. Change assertion about rank of array to runtime error. (`m'name`'rtype_qual`_'atype_code): Likewise. * generated/all_l4.c: Regenerated. * generated/all_l8.c: Regenerated. * generated/any_l4.c: Regenerated. * generated/any_l8.c: Regenerated. * generated/count_4_l4.c: Regenerated. * generated/count_4_l8.c: Regenerated. * generated/count_8_l4.c: Regenerated. * generated/count_8_l8.c: Regenerated. * generated/maxloc0_4_i4.c: Regenerated. * generated/maxloc0_4_i8.c: Regenerated. * generated/maxloc0_4_r4.c: Regenerated. * generated/maxloc0_4_r8.c: Regenerated. * generated/maxloc0_8_i4.c: Regenerated. * generated/maxloc0_8_i8.c: Regenerated. * generated/maxloc0_8_r4.c: Regenerated. * generated/maxloc0_8_r8.c: Regenerated. * generated/maxloc1_4_i4.c: Regenerated. * generated/maxloc1_4_i8.c: Regenerated. * generated/maxloc1_4_r4.c: Regenerated. * generated/maxloc1_4_r8.c: Regenerated. * generated/maxloc1_8_i4.c: Regenerated. * generated/maxloc1_8_i8.c: Regenerated. * generated/maxloc1_8_r4.c: Regenerated. * generated/maxloc1_8_r8.c: Regenerated. * generated/maxval_i4.c: Regenerated. * generated/maxval_i8.c: Regenerated. * generated/maxval_r4.c: Regenerated. * generated/maxval_r8.c: Regenerated. * generated/minloc0_4_i4.c: Regenerated. * generated/minloc0_4_i8.c: Regenerated. * generated/minloc0_4_r4.c: Regenerated. * generated/minloc0_4_r8.c: Regenerated. * generated/minloc0_8_i4.c: Regenerated. * generated/minloc0_8_i8.c: Regenerated. * generated/minloc0_8_r4.c: Regenerated. * generated/minloc0_8_r8.c: Regenerated. * generated/minloc1_4_i4.c: Regenerated. * generated/minloc1_4_i8.c: Regenerated. * generated/minloc1_4_r4.c: Regenerated. * generated/minloc1_4_r8.c: Regenerated. * generated/minloc1_8_i4.c: Regenerated. * generated/minloc1_8_i8.c: Regenerated. * generated/minloc1_8_r4.c: Regenerated. * generated/minloc1_8_r8.c: Regenerated. * generated/minval_i4.c: Regenerated. * generated/minval_i8.c: Regenerated. * generated/minval_r4.c: Regenerated. * generated/minval_r8.c: Regenerated. * generated/product_c4.c: Regenerated. * generated/product_c8.c: Regenerated. * generated/product_i4.c: Regenerated. * generated/product_i8.c: Regenerated. * generated/product_r4.c: Regenerated. * generated/product_r8.c: Regenerated. * generated/sum_c4.c: Regenerated. * generated/sum_c8.c: Regenerated. * generated/sum_i4.c: Regenerated. * generated/sum_i8.c: Regenerated. * generated/sum_r4.c: Regenerated. * generated/sum_r8.c: Regenerated. 2005-04-09 Thomas Koenig <Thomas.Koenig@online.de> * gfortran.fortran-torture/execute/intrinsic_anyall.f90: Added test for callee-allocated arrays with write statements. * gfortran.fortran-torture/execute/intrinsic_count.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_mmloc.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_mmval.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_product.f90: Likewise. * gfortran.fortran-torture/execute/intrinsic_sum.f90: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97929 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/generated/maxloc1_8_r8.c')
-rw-r--r--libgfortran/generated/maxloc1_8_r8.c45
1 files changed, 38 insertions, 7 deletions
diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c
index 107cbee3682..b1f780567da 100644
--- a/libgfortran/generated/maxloc1_8_r8.c
+++ b/libgfortran/generated/maxloc1_8_r8.c
@@ -57,11 +57,8 @@ maxloc1_8_r8 (gfc_array_i8 *retarray, gfc_array_r8 *array, index_type *pdim)
/* Make dim zero based to avoid confusion. */
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
- assert (rank == GFC_DESCRIPTOR_RANK (retarray));
if (array->dim[0].stride == 0)
array->dim[0].stride = 1;
- if (retarray->dim[0].stride == 0)
- retarray->dim[0].stride = 1;
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
delta = array->dim[dim].stride;
@@ -95,8 +92,17 @@ maxloc1_8_r8 (gfc_array_i8 *retarray, gfc_array_r8 *array, index_type *pdim)
* retarray->dim[rank-1].stride
* extent[rank-1]);
retarray->base = 0;
+ retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
}
-
+ else
+ {
+ if (retarray->dim[0].stride == 0)
+ retarray->dim[0].stride = 1;
+
+ if (rank != GFC_DESCRIPTOR_RANK (retarray))
+ runtime_error ("rank of return array incorrect");
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
@@ -191,11 +197,8 @@ mmaxloc1_8_r8 (gfc_array_i8 * retarray, gfc_array_r8 * array,
dim = (*pdim) - 1;
rank = GFC_DESCRIPTOR_RANK (array) - 1;
- assert (rank == GFC_DESCRIPTOR_RANK (retarray));
if (array->dim[0].stride == 0)
array->dim[0].stride = 1;
- if (retarray->dim[0].stride == 0)
- retarray->dim[0].stride = 1;
len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
if (len <= 0)
@@ -217,6 +220,34 @@ mmaxloc1_8_r8 (gfc_array_i8 * retarray, gfc_array_r8 * array,
array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
}
+ if (retarray->data == NULL)
+ {
+ for (n = 0; n < rank; n++)
+ {
+ retarray->dim[n].lbound = 0;
+ retarray->dim[n].ubound = extent[n]-1;
+ if (n == 0)
+ retarray->dim[n].stride = 1;
+ else
+ retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+ }
+
+ retarray->data
+ = internal_malloc_size (sizeof (GFC_INTEGER_8)
+ * retarray->dim[rank-1].stride
+ * extent[rank-1]);
+ retarray->base = 0;
+ retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+ }
+ else
+ {
+ if (retarray->dim[0].stride == 0)
+ retarray->dim[0].stride = 1;
+
+ if (rank != GFC_DESCRIPTOR_RANK (retarray))
+ runtime_error ("rank of return array incorrect");
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;