diff options
author | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-25 09:56:37 +0000 |
---|---|---|
committer | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-06-25 09:56:37 +0000 |
commit | 71a8a4b3c9e5898168f8833055596815ff640796 (patch) | |
tree | 0bfeede6e9240f3c069b66974e9813ec2385f821 /libgfortran | |
parent | 67ce556b47830dd825524e8370969b814c355216 (diff) | |
download | gcc-71a8a4b3c9e5898168f8833055596815ff640796.tar.gz |
2005-06-25 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/22144
* m4/cshift1.m4: Remove const from argument ret.
Populate return array descriptor if ret->data is NULL.
* m4/eoshift1.m4: Likewise.
* m4/eoshift3.m4: Likewise.
* generated/cshift1_4.c: Regenerated.
* generated/cshift1_8.c: Regenerated.
* generated/eoshift1_4.c: Regenerated.
* generated/eoshift1_8.c: Regenerated.
* generated/eoshift3_4.c: Regenerated.
* generated/eoshift3_8.c: Regenerated.
2005-06-25 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/21144
* gfortran.dg/shift-alloc.f90: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101318 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 14 | ||||
-rw-r--r-- | libgfortran/generated/cshift1_4.c | 23 | ||||
-rw-r--r-- | libgfortran/generated/cshift1_8.c | 23 | ||||
-rw-r--r-- | libgfortran/generated/eoshift1_4.c | 24 | ||||
-rw-r--r-- | libgfortran/generated/eoshift1_8.c | 24 | ||||
-rw-r--r-- | libgfortran/generated/eoshift3_4.c | 19 | ||||
-rw-r--r-- | libgfortran/generated/eoshift3_8.c | 19 | ||||
-rw-r--r-- | libgfortran/m4/cshift1.m4 | 23 | ||||
-rw-r--r-- | libgfortran/m4/eoshift1.m4 | 24 | ||||
-rw-r--r-- | libgfortran/m4/eoshift3.m4 | 19 |
10 files changed, 200 insertions, 12 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 06c3e4b3669..9b2ddec62d2 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,17 @@ +2005-06-25 Thomas Koenig <Thomas.Koenig@online.de> + + PR libfortran/22144 + * m4/cshift1.m4: Remove const from argument ret. + Populate return array descriptor if ret->data is NULL. + * m4/eoshift1.m4: Likewise. + * m4/eoshift3.m4: Likewise. + * generated/cshift1_4.c: Regenerated. + * generated/cshift1_8.c: Regenerated. + * generated/eoshift1_4.c: Regenerated. + * generated/eoshift1_8.c: Regenerated. + * generated/eoshift3_4.c: Regenerated. + * generated/eoshift3_8.c: Regenerated. + 2005-06-24 Jerry DeLisle <jvdelisle@verizon.net> PR libfortran/21915 diff --git a/libgfortran/generated/cshift1_4.c b/libgfortran/generated/cshift1_4.c index 683ce703ff2..b86f9e51c7e 100644 --- a/libgfortran/generated/cshift1_4.c +++ b/libgfortran/generated/cshift1_4.c @@ -34,13 +34,13 @@ Boston, MA 02111-1307, USA. */ #include <string.h> #include "libgfortran.h" -void cshift1_4 (const gfc_array_char * ret, +void cshift1_4 (gfc_array_char * ret, const gfc_array_char * array, const gfc_array_i4 * h, const GFC_INTEGER_4 * pwhich); export_proto(cshift1_4); void -cshift1_4 (const gfc_array_char * ret, +cshift1_4 (gfc_array_char * ret, const gfc_array_char * array, const gfc_array_i4 * h, const GFC_INTEGER_4 * pwhich) { @@ -80,6 +80,25 @@ cshift1_4 (const gfc_array_char * ret, size = GFC_DESCRIPTOR_SIZE (ret); + if (ret->data == NULL) + { + int i; + + ret->data = internal_malloc_size (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; + } + } + extent[0] = 1; count[0] = 0; size = GFC_DESCRIPTOR_SIZE (array); diff --git a/libgfortran/generated/cshift1_8.c b/libgfortran/generated/cshift1_8.c index 6513b910304..24c1b6e89e3 100644 --- a/libgfortran/generated/cshift1_8.c +++ b/libgfortran/generated/cshift1_8.c @@ -34,13 +34,13 @@ Boston, MA 02111-1307, USA. */ #include <string.h> #include "libgfortran.h" -void cshift1_8 (const gfc_array_char * ret, +void cshift1_8 (gfc_array_char * ret, const gfc_array_char * array, const gfc_array_i8 * h, const GFC_INTEGER_8 * pwhich); export_proto(cshift1_8); void -cshift1_8 (const gfc_array_char * ret, +cshift1_8 (gfc_array_char * ret, const gfc_array_char * array, const gfc_array_i8 * h, const GFC_INTEGER_8 * pwhich) { @@ -80,6 +80,25 @@ cshift1_8 (const gfc_array_char * ret, size = GFC_DESCRIPTOR_SIZE (ret); + if (ret->data == NULL) + { + int i; + + ret->data = internal_malloc_size (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; + } + } + extent[0] = 1; count[0] = 0; size = GFC_DESCRIPTOR_SIZE (array); diff --git a/libgfortran/generated/eoshift1_4.c b/libgfortran/generated/eoshift1_4.c index 3503f825c6a..833efa2ae00 100644 --- a/libgfortran/generated/eoshift1_4.c +++ b/libgfortran/generated/eoshift1_4.c @@ -37,14 +37,14 @@ Boston, MA 02111-1307, USA. */ static const char zeros[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -extern void eoshift1_4 (const gfc_array_char *, +extern void eoshift1_4 (gfc_array_char *, const gfc_array_char *, const gfc_array_i4 *, const char *, const GFC_INTEGER_4 *); export_proto(eoshift1_4); void -eoshift1_4 (const gfc_array_char *ret, +eoshift1_4 (gfc_array_char *ret, const gfc_array_char *array, const gfc_array_i4 *h, const char *pbound, const GFC_INTEGER_4 *pwhich) @@ -95,6 +95,26 @@ eoshift1_4 (const gfc_array_char *ret, extent[0] = 1; count[0] = 0; size = GFC_DESCRIPTOR_SIZE (array); + + if (ret->data == NULL) + { + int i; + + ret->data = internal_malloc_size (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; + } + } + n = 0; for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) { diff --git a/libgfortran/generated/eoshift1_8.c b/libgfortran/generated/eoshift1_8.c index bfa608814ff..75d0f1e1e3d 100644 --- a/libgfortran/generated/eoshift1_8.c +++ b/libgfortran/generated/eoshift1_8.c @@ -37,14 +37,14 @@ Boston, MA 02111-1307, USA. */ static const char zeros[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -extern void eoshift1_8 (const gfc_array_char *, +extern void eoshift1_8 (gfc_array_char *, const gfc_array_char *, const gfc_array_i8 *, const char *, const GFC_INTEGER_8 *); export_proto(eoshift1_8); void -eoshift1_8 (const gfc_array_char *ret, +eoshift1_8 (gfc_array_char *ret, const gfc_array_char *array, const gfc_array_i8 *h, const char *pbound, const GFC_INTEGER_8 *pwhich) @@ -95,6 +95,26 @@ eoshift1_8 (const gfc_array_char *ret, extent[0] = 1; count[0] = 0; size = GFC_DESCRIPTOR_SIZE (array); + + if (ret->data == NULL) + { + int i; + + ret->data = internal_malloc_size (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; + } + } + n = 0; for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) { diff --git a/libgfortran/generated/eoshift3_4.c b/libgfortran/generated/eoshift3_4.c index 964d98b55ed..14c38b7bd6a 100644 --- a/libgfortran/generated/eoshift3_4.c +++ b/libgfortran/generated/eoshift3_4.c @@ -90,6 +90,25 @@ eoshift3_4 (gfc_array_char *ret, gfc_array_char *array, which = 0; size = GFC_DESCRIPTOR_SIZE (ret); + if (ret->data == NULL) + { + int i; + + ret->data = internal_malloc_size (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; + } + } + extent[0] = 1; count[0] = 0; diff --git a/libgfortran/generated/eoshift3_8.c b/libgfortran/generated/eoshift3_8.c index c17b5885e28..77617b07417 100644 --- a/libgfortran/generated/eoshift3_8.c +++ b/libgfortran/generated/eoshift3_8.c @@ -90,6 +90,25 @@ eoshift3_8 (gfc_array_char *ret, gfc_array_char *array, which = 0; size = GFC_DESCRIPTOR_SIZE (ret); + if (ret->data == NULL) + { + int i; + + ret->data = internal_malloc_size (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; + } + } + extent[0] = 1; count[0] = 0; diff --git a/libgfortran/m4/cshift1.m4 b/libgfortran/m4/cshift1.m4 index 308c3dc40f8..dd7653ab517 100644 --- a/libgfortran/m4/cshift1.m4 +++ b/libgfortran/m4/cshift1.m4 @@ -35,13 +35,13 @@ Boston, MA 02111-1307, USA. */ #include "libgfortran.h"' include(iparm.m4)dnl -void cshift1_`'atype_kind (const gfc_array_char * ret, +void cshift1_`'atype_kind (gfc_array_char * ret, const gfc_array_char * array, const atype * h, const atype_name * pwhich); export_proto(cshift1_`'atype_kind); void -cshift1_`'atype_kind (const gfc_array_char * ret, +cshift1_`'atype_kind (gfc_array_char * ret, const gfc_array_char * array, const atype * h, const atype_name * pwhich) { @@ -81,6 +81,25 @@ cshift1_`'atype_kind (const gfc_array_char * ret, size = GFC_DESCRIPTOR_SIZE (ret); + if (ret->data == NULL) + { + int i; + + ret->data = internal_malloc_size (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; + } + } + extent[0] = 1; count[0] = 0; size = GFC_DESCRIPTOR_SIZE (array); diff --git a/libgfortran/m4/eoshift1.m4 b/libgfortran/m4/eoshift1.m4 index b21c6d34732..1d13f482081 100644 --- a/libgfortran/m4/eoshift1.m4 +++ b/libgfortran/m4/eoshift1.m4 @@ -38,14 +38,14 @@ include(iparm.m4)dnl static const char zeros[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; -extern void eoshift1_`'atype_kind (const gfc_array_char *, +extern void eoshift1_`'atype_kind (gfc_array_char *, const gfc_array_char *, const atype *, const char *, const atype_name *); export_proto(eoshift1_`'atype_kind); void -eoshift1_`'atype_kind (const gfc_array_char *ret, +eoshift1_`'atype_kind (gfc_array_char *ret, const gfc_array_char *array, const atype *h, const char *pbound, const atype_name *pwhich) @@ -96,6 +96,26 @@ eoshift1_`'atype_kind (const gfc_array_char *ret, extent[0] = 1; count[0] = 0; size = GFC_DESCRIPTOR_SIZE (array); + + if (ret->data == NULL) + { + int i; + + ret->data = internal_malloc_size (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; + } + } + n = 0; for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++) { diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4 index 6cbb87cfb84..5001756df0c 100644 --- a/libgfortran/m4/eoshift3.m4 +++ b/libgfortran/m4/eoshift3.m4 @@ -91,6 +91,25 @@ eoshift3_`'atype_kind (gfc_array_char *ret, gfc_array_char *array, which = 0; size = GFC_DESCRIPTOR_SIZE (ret); + if (ret->data == NULL) + { + int i; + + ret->data = internal_malloc_size (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; + } + } + extent[0] = 1; count[0] = 0; |