diff options
author | Victor Leikehman <lei@il.ibm.com> | 2004-08-04 14:30:46 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2004-08-04 14:30:46 +0000 |
commit | 6c167c45b1059150631362a647864ee0ca900a91 (patch) | |
tree | 4227da0c8f70c91f8b20b53d9be0ca661b7f838a /libgfortran/m4 | |
parent | 2acc29bdd3bc49da5eca42a0f1c014f972e9ef20 (diff) | |
download | gcc-6c167c45b1059150631362a647864ee0ca900a91.zip gcc-6c167c45b1059150631362a647864ee0ca900a91.tar.gz gcc-6c167c45b1059150631362a647864ee0ca900a91.tar.bz2 |
* 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.
From-SVN: r85558
Diffstat (limited to 'libgfortran/m4')
-rw-r--r-- | libgfortran/m4/ifunction.m4 | 17 | ||||
-rw-r--r-- | libgfortran/m4/transpose.m4 | 17 |
2 files changed, 34 insertions, 0 deletions
diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4 index 74cc1e6..14bd0a6 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 fbc4950..5fd6acf 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) |