summaryrefslogtreecommitdiff
path: root/libgfortran/generated/spread_i16.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/generated/spread_i16.c')
-rw-r--r--libgfortran/generated/spread_i16.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/libgfortran/generated/spread_i16.c b/libgfortran/generated/spread_i16.c
index f4ad0180cce..3690ceb2a4f 100644
--- a/libgfortran/generated/spread_i16.c
+++ b/libgfortran/generated/spread_i16.c
@@ -70,11 +70,12 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source,
if (ret->base_addr == NULL)
{
- size_t ub, stride;
+ size_t ext, stride;
/* The front end has signalled that we need to populate the
return array descriptor. */
- ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rrank;
+ ret->elem_len = source->elem_len;
+ ret->type = source->type;
dim = 0;
rs = 1;
for (n = 0; n < rrank; n++)
@@ -82,7 +83,7 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source,
stride = rs;
if (n == along - 1)
{
- ub = ncopies - 1;
+ ext = ncopies;
rdelta = rs;
rs *= ncopies;
}
@@ -90,14 +91,14 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source,
{
count[dim] = 0;
extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
- sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim);
+ sstride[dim] = GFC_DESCRIPTOR_STRIDE_TYPEKNOWN(source,dim);
rstride[dim] = rs;
- ub = extent[dim] - 1;
+ ext = extent[dim];
rs *= extent[dim];
dim++;
}
- GFC_DIMENSION_SET(ret->dim[n], 0, ub, stride);
+ GFC_DIMENSION_SET(ret->dim[n], 0, ext, stride * sizeof(GFC_INTEGER_16));
}
ret->offset = 0;
@@ -125,7 +126,7 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source,
ret_extent = GFC_DESCRIPTOR_EXTENT(ret,n);
if (n == along - 1)
{
- rdelta = GFC_DESCRIPTOR_STRIDE(ret,n);
+ rdelta = GFC_DESCRIPTOR_STRIDE_TYPEKNOWN(ret,n);
if (ret_extent != ncopies)
runtime_error("Incorrect extent in return value of SPREAD"
@@ -146,8 +147,8 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source,
if (extent[dim] <= 0)
zero_sized = 1;
- sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim);
- rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n);
+ sstride[dim] = GFC_DESCRIPTOR_STRIDE_TYPEKNOWN(source,dim);
+ rstride[dim] = GFC_DESCRIPTOR_STRIDE_TYPEKNOWN(ret,n);
dim++;
}
}
@@ -158,7 +159,7 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source,
{
if (n == along - 1)
{
- rdelta = GFC_DESCRIPTOR_STRIDE(ret,n);
+ rdelta = GFC_DESCRIPTOR_STRIDE_TYPEKNOWN(ret,n);
}
else
{
@@ -166,8 +167,8 @@ spread_i16 (gfc_array_i16 *ret, const gfc_array_i16 *source,
extent[dim] = GFC_DESCRIPTOR_EXTENT(source,dim);
if (extent[dim] <= 0)
zero_sized = 1;
- sstride[dim] = GFC_DESCRIPTOR_STRIDE(source,dim);
- rstride[dim] = GFC_DESCRIPTOR_STRIDE(ret,n);
+ sstride[dim] = GFC_DESCRIPTOR_STRIDE_TYPEKNOWN(source,dim);
+ rstride[dim] = GFC_DESCRIPTOR_STRIDE_TYPEKNOWN(ret,n);
dim++;
}
}
@@ -246,17 +247,17 @@ spread_scalar_i16 (gfc_array_i16 *ret, const GFC_INTEGER_16 *source,
{
ret->base_addr = xmallocarray (ncopies, sizeof (GFC_INTEGER_16));
ret->offset = 0;
- GFC_DIMENSION_SET(ret->dim[0], 0, ncopies - 1, 1);
+ GFC_DIMENSION_SET(ret->dim[0], 0, ncopies, sizeof (GFC_INTEGER_16));
}
else
{
if (ncopies - 1 > (GFC_DESCRIPTOR_EXTENT(ret,0) - 1)
- / GFC_DESCRIPTOR_STRIDE(ret,0))
+ / GFC_DESCRIPTOR_STRIDE_TYPEKNOWN(ret,0))
runtime_error ("dim too large in spread()");
}
dest = ret->base_addr;
- stride = GFC_DESCRIPTOR_STRIDE(ret,0);
+ stride = GFC_DESCRIPTOR_STRIDE_TYPEKNOWN(ret,0);
for (n = 0; n < ncopies; n++)
{