diff options
author | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-30 13:16:36 +0000 |
---|---|---|
committer | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-12-30 13:16:36 +0000 |
commit | a14c06e97aeeb4b6c164edf6d00fab4e82642d84 (patch) | |
tree | c4d838dbc27d49cca645bfaba8a83f2b0ebddd53 /libgfortran/generated/minloc1_8_r16.c | |
parent | 6ec458b2d6b10716933c312cbcf36effc0d15603 (diff) | |
download | gcc-a14c06e97aeeb4b6c164edf6d00fab4e82642d84.tar.gz |
2006-12-30 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/30321
* m4/ifunction.m4 (name`'rtype_qual`_'atype_code):
Check for extents < 0 for zero-sized arrays. If
no retarray has been specified and the size is zero,
return early.
(`m'name`'rtype_qual`_'atype_code): Likewise.
* generated/all_l16.c: Regenerated.
* generated/all_l4.c: Regenerated.
* generated/all_l8.c: Regenerated.
* generated/any_l16.c: Regenerated.
* generated/any_l4.c: Regenerated.
* generated/any_l8.c: Regenerated.
* generated/count_16_l16.c: Regenerated.
* generated/count_16_l4.c: Regenerated.
* generated/count_16_l8.c: Regenerated.
* generated/count_4_l16.c: Regenerated.
* generated/count_4_l4.c: Regenerated.
* generated/count_4_l8.c: Regenerated.
* generated/count_8_l16.c: Regenerated.
* generated/count_8_l4.c: Regenerated.
* generated/count_8_l8.c: Regenerated.
* generated/cshift1_16.c: Regenerated.
* generated/cshift1_4.c: Regenerated.
* generated/cshift1_8.c: Regenerated.
* generated/maxloc1_16_i16.c: Regenerated.
* generated/maxloc1_16_i4.c: Regenerated.
* generated/maxloc1_16_i8.c: Regenerated.
* generated/maxloc1_16_r10.c: Regenerated.
* generated/maxloc1_16_r16.c: Regenerated.
* generated/maxloc1_16_r4.c: Regenerated.
* generated/maxloc1_16_r8.c: Regenerated.
* generated/maxloc1_4_i16.c: Regenerated.
* generated/maxloc1_4_i4.c: Regenerated.
* generated/maxloc1_4_i8.c: Regenerated.
* generated/maxloc1_4_r10.c: Regenerated.
* generated/maxloc1_4_r16.c: Regenerated.
* generated/maxloc1_4_r4.c: Regenerated.
* generated/maxloc1_4_r8.c: Regenerated.
* generated/maxloc1_8_i16.c: Regenerated.
* generated/maxloc1_8_i4.c: Regenerated.
* generated/maxloc1_8_i8.c: Regenerated.
* generated/maxloc1_8_r10.c: Regenerated.
* generated/maxloc1_8_r16.c: Regenerated.
* generated/maxloc1_8_r4.c: Regenerated.
* generated/maxloc1_8_r8.c: Regenerated.
* generated/maxval_i16.c: Regenerated.
* generated/maxval_i4.c: Regenerated.
* generated/maxval_i8.c: Regenerated.
* generated/maxval_r10.c: Regenerated.
* generated/maxval_r16.c: Regenerated.
* generated/maxval_r4.c: Regenerated.
* generated/maxval_r8.c: Regenerated.
* generated/minloc1_16_i16.c: Regenerated.
* generated/minloc1_16_i4.c: Regenerated.
* generated/minloc1_16_i8.c: Regenerated.
* generated/minloc1_16_r10.c: Regenerated.
* generated/minloc1_16_r16.c: Regenerated.
* generated/minloc1_16_r4.c: Regenerated.
* generated/minloc1_16_r8.c: Regenerated.
* generated/minloc1_4_i16.c: Regenerated.
* generated/minloc1_4_i4.c: Regenerated.
* generated/minloc1_4_i8.c: Regenerated.
* generated/minloc1_4_r10.c: Regenerated.
* generated/minloc1_4_r16.c: Regenerated.
* generated/minloc1_4_r4.c: Regenerated.
* generated/minloc1_4_r8.c: Regenerated.
* generated/minloc1_8_i16.c: Regenerated.
* generated/minloc1_8_i4.c: Regenerated.
* generated/minloc1_8_i8.c: Regenerated.
* generated/minloc1_8_r10.c: Regenerated.
* generated/minloc1_8_r16.c: Regenerated.
* generated/minloc1_8_r4.c: Regenerated.
* generated/minloc1_8_r8.c: Regenerated.
* generated/minval_i16.c: Regenerated.
* generated/minval_i4.c: Regenerated.
* generated/minval_i8.c: Regenerated.
* generated/minval_r10.c: Regenerated.
* generated/minval_r16.c: Regenerated.
* generated/minval_r4.c: Regenerated.
* generated/minval_r8.c: Regenerated.
* generated/product_c10.c: Regenerated.
* generated/product_c16.c: Regenerated.
* generated/product_c4.c: Regenerated.
* generated/product_c8.c: Regenerated.
* generated/product_i16.c: Regenerated.
* generated/product_i4.c: Regenerated.
* generated/product_i8.c: Regenerated.
* generated/product_r10.c: Regenerated.
* generated/product_r16.c: Regenerated.
* generated/product_r4.c: Regenerated.
* generated/product_r8.c: Regenerated.
* generated/sum_c10.c: Regenerated.
* generated/sum_c16.c: Regenerated.
* generated/sum_c4.c: Regenerated.
* generated/sum_c8.c: Regenerated.
* generated/sum_i16.c: Regenerated.
* generated/sum_i4.c: Regenerated.
* generated/sum_i8.c: Regenerated.
* generated/sum_r10.c: Regenerated.
* generated/sum_r16.c: Regenerated.
* generated/sum_r4.c: Regenerated.
* generated/sum_r8.c: Regenerated.
2006-12-30 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/30321
* gfortran.dg/sum_zero_array_1.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120287 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran/generated/minloc1_8_r16.c')
-rw-r--r-- | libgfortran/generated/minloc1_8_r16.c | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c index 74eb70bc354..30753ce24f4 100644 --- a/libgfortran/generated/minloc1_8_r16.c +++ b/libgfortran/generated/minloc1_8_r16.c @@ -71,16 +71,24 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, { sstride[n] = array->dim[n].stride; extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + + if (extent[n] < 0) + extent[n] = 0; } for (n = dim; n < rank; n++) { sstride[n] = array->dim[n + 1].stride; extent[n] = array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + + if (extent[n] < 0) + extent[n] = 0; } if (retarray->data == NULL) { + size_t alloc_size; + for (n = 0; n < rank; n++) { retarray->dim[n].lbound = 0; @@ -91,12 +99,21 @@ minloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; } - retarray->data - = internal_malloc_size (sizeof (GFC_INTEGER_8) - * retarray->dim[rank-1].stride - * extent[rank-1]); retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + + alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + * extent[rank-1]; + + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ + retarray->dim[0].lbound = 0; + retarray->dim[0].ubound = -1; + return; + } + else + retarray->data = internal_malloc_size (alloc_size); } else { @@ -213,6 +230,10 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, sstride[n] = array->dim[n].stride; mstride[n] = mask->dim[n].stride; extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound; + + if (extent[n] < 0) + extent[n] = 0; + } for (n = dim; n < rank; n++) { @@ -220,10 +241,15 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, mstride[n] = mask->dim[n + 1].stride; extent[n] = array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound; + + if (extent[n] < 0) + extent[n] = 0; } if (retarray->data == NULL) { + size_t alloc_size; + for (n = 0; n < rank; n++) { retarray->dim[n].lbound = 0; @@ -234,12 +260,22 @@ mminloc1_8_r16 (gfc_array_i8 * const restrict retarray, retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1]; } - retarray->data - = internal_malloc_size (sizeof (GFC_INTEGER_8) - * retarray->dim[rank-1].stride - * extent[rank-1]); + alloc_size = sizeof (GFC_INTEGER_8) * retarray->dim[rank-1].stride + * extent[rank-1]; + retarray->offset = 0; retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank; + + if (alloc_size == 0) + { + /* Make sure we have a zero-sized array. */ + retarray->dim[0].lbound = 0; + retarray->dim[0].ubound = -1; + return; + } + else + retarray->data = internal_malloc_size (alloc_size); + } else { |