summaryrefslogtreecommitdiff
path: root/libgfortran/m4
diff options
context:
space:
mode:
authorpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-04 14:30:46 +0000
committerpbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4>2004-08-04 14:30:46 +0000
commit5fcc57ced0054855920854726836938ace1573c9 (patch)
tree4227da0c8f70c91f8b20b53d9be0ca661b7f838a /libgfortran/m4
parent90b0414cbc5cef048c8460ac715ac933fcc4c16b (diff)
downloadgcc-5fcc57ced0054855920854726836938ace1573c9.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85558 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/m4')
-rw-r--r--libgfortran/m4/ifunction.m417
-rw-r--r--libgfortran/m4/transpose.m417
2 files changed, 34 insertions, 0 deletions
diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4
index 74cc1e63cd9..14bd0a63997 100644
--- a/libgfortran/m4/ifunction.m4
+++ b/libgfortran/m4/ifunction.m4
@@ -57,6 +57,23 @@ define(START_ARRAY_FUNCTION,
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;
diff --git a/libgfortran/m4/transpose.m4 b/libgfortran/m4/transpose.m4
index fbc49501097..5fd6acfb228 100644
--- a/libgfortran/m4/transpose.m4
+++ b/libgfortran/m4/transpose.m4
@@ -39,6 +39,23 @@ void
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)