+2004-08-04 Victor Leikehman <lei@il.ibm.com>
+
+ * libgfortran.h (array_t, size0) New declarations.
+ * m4/ifunction.m4, m4/transpose.m4, intrinsics/cshift0.c: Allocate
+ space if return value descriptor has NULL in its data field,
+ and initialize bounds and stride.
+ * intrinsics/size.c (array_t, size0): Declarations moved to
+ libgfortran.h.
+ * generated/*.c: Regenerate.
+
2004-08-03 Roger Sayle <roger@eyesopen.com>
PR libgfortran/16137
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 (sizeof (GFC_LOGICAL_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_LOGICAL_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_LOGICAL_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_LOGICAL_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_REAL_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_REAL_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_REAL_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_REAL_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_COMPLEX_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_COMPLEX_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_REAL_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_REAL_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_COMPLEX_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_COMPLEX_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_INTEGER_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_REAL_4) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
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 (sizeof (GFC_REAL_8) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
assert (GFC_DESCRIPTOR_RANK (source) == 2);
+ if (ret->data == NULL)
+ {
+ ret->data = internal_malloc (sizeof (GFC_INTEGER_4) * size0 (source));
+ ret->base = 0;
+ ret->dtype = source->dtype;
+
+ ret->dim[0].lbound = 0;
+ ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound;
+ ret->dim[0].stride = 1;
+
+ ret->dim[1].lbound = 0;
+ ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound;
+ ret->dim[1].stride = ret->dim[0].ubound+1;
+ }
+
if (ret->dim[0].stride == 0)
ret->dim[0].stride = 1;
if (source->dim[0].stride == 0)
assert (GFC_DESCRIPTOR_RANK (source) == 2);
+ if (ret->data == NULL)
+ {
+ ret->data = internal_malloc (sizeof (GFC_INTEGER_8) * size0 (source));
+ ret->base = 0;
+ ret->dtype = source->dtype;
+
+ ret->dim[0].lbound = 0;
+ ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound;
+ ret->dim[0].stride = 1;
+
+ ret->dim[1].lbound = 0;
+ ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound;
+ ret->dim[1].stride = ret->dim[0].ubound+1;
+ }
+
if (ret->dim[0].stride == 0)
ret->dim[0].stride = 1;
if (source->dim[0].stride == 0)
sizeof(int) < sizeof (index_type). */
static void
-__cshift0 (const gfc_array_char * ret, const gfc_array_char * array,
+__cshift0 (gfc_array_char * ret, const gfc_array_char * array,
int shift, int which)
{
/* r.* indicates the return array. */
soffset = size;
len = 0;
+ if (ret->data == NULL)
+ {
+ int i;
+
+ ret->data = internal_malloc (size * size0 ((array_t *)array));
+ ret->base = 0;
+ ret->dtype = array->dtype;
+ for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
+ {
+ ret->dim[i].lbound = 0;
+ ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
+
+ if (i == 0)
+ ret->dim[i].stride = 1;
+ else
+ ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
+ }
+ }
+
for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
{
if (dim == which)
void
-__cshift0_4 (const gfc_array_char * ret, const gfc_array_char * array,
+__cshift0_4 (gfc_array_char * ret, const gfc_array_char * array,
const GFC_INTEGER_4 * pshift, const GFC_INTEGER_4 * pdim)
{
__cshift0 (ret, array, *pshift, pdim ? *pdim : 1);
void
-__cshift0_8 (const gfc_array_char * ret, const gfc_array_char * array,
+__cshift0_8 (gfc_array_char * ret, const gfc_array_char * array,
const GFC_INTEGER_8 * pshift, const GFC_INTEGER_8 * pdim)
{
__cshift0 (ret, array, *pshift, pdim ? *pdim : 1);
#include "libgfortran.h"
-typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) array_t;
-
-#define size0 prefix(size0)
index_type size0 (const array_t * array)
{
int n;
#define normalize_r8_i8 prefix(normalize_r8_i8)
GFC_REAL_8 normalize_r8_i8 (GFC_UINTEGER_8, GFC_UINTEGER_8);
+/* size.c */
+
+typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) array_t;
+
+#define size0 prefix(size0)
+index_type size0 (const array_t * array);
+
#endif
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 (sizeof (rtype_name) *
+ (retarray->dim[rank-1].stride * extent[rank-1]));
+ retarray->base = 0;
+ }
+
for (n = 0; n < rank; n++)
{
count[n] = 0;
assert (GFC_DESCRIPTOR_RANK (source) == 2);
+ if (ret->data == NULL)
+ {
+ assert (GFC_DESCRIPTOR_RANK (ret) == 2);
+ assert (ret->dtype == source->dtype);
+
+ ret->dim[0].lbound = 0;
+ ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound;
+ ret->dim[0].stride = 1;
+
+ ret->dim[1].lbound = 0;
+ ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound;
+ ret->dim[1].stride = ret->dim[0].ubound+1;
+
+ ret->data = internal_malloc (sizeof (rtype_name) * size0 (ret));
+ ret->base = 0;
+ }
+
if (ret->dim[0].stride == 0)
ret->dim[0].stride = 1;
if (source->dim[0].stride == 0)