diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-05-04 19:07:28 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2008-05-04 19:07:28 +0000 |
commit | da96f5ab49d8e45bdca0d08c5ecc408ddbc3de47 (patch) | |
tree | b2ffeecf45cdd998f85c6ea3842a5747af150b22 /libgfortran/m4 | |
parent | 62d2739afd9e0b8cea92edae521222930b67743d (diff) | |
download | gcc-da96f5ab49d8e45bdca0d08c5ecc408ddbc3de47.zip gcc-da96f5ab49d8e45bdca0d08c5ecc408ddbc3de47.tar.gz gcc-da96f5ab49d8e45bdca0d08c5ecc408ddbc3de47.tar.bz2 |
re PR fortran/35995 (ANY, ALL, and COUNT errors for zero sized sections)
2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/35995
* m4/ifunction_logical.m4: If the extent of "array"
is less than zero, set it to zero. Use an explicit
flag for breaking out of the main loop to avoid, because
the data pointer for "array" may be NULL for an empty
array.
* m4/ifunction.m4: Likewise.
* generated/all_l1.c: Regenerated.
* generated/all_l16.c: Regenerated.
* generated/all_l2.c: Regenerated.
* generated/all_l4.c: Regenerated.
* generated/all_l8.c: Regenerated.
* generated/any_l1.c: Regenerated.
* generated/any_l16.c: Regenerated.
* generated/any_l2.c: Regenerated.
* generated/any_l4.c: Regenerated.
* generated/any_l8.c: Regenerated.
* generated/count_16_l.c: Regenerated.
* generated/count_1_l.c: Regenerated.
* generated/count_2_l.c: Regenerated.
* generated/count_4_l.c: Regenerated.
* generated/count_8_l.c: Regenerated.
* generated/maxloc1_16_i1.c: Regenerated.
* generated/maxloc1_16_i16.c: Regenerated.
* generated/maxloc1_16_i2.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_i1.c: Regenerated.
* generated/maxloc1_4_i16.c: Regenerated.
* generated/maxloc1_4_i2.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_i1.c: Regenerated.
* generated/maxloc1_8_i16.c: Regenerated.
* generated/maxloc1_8_i2.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_i1.c: Regenerated.
* generated/maxval_i16.c: Regenerated.
* generated/maxval_i2.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_i1.c: Regenerated.
* generated/minloc1_16_i16.c: Regenerated.
* generated/minloc1_16_i2.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_i1.c: Regenerated.
* generated/minloc1_4_i16.c: Regenerated.
* generated/minloc1_4_i2.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_i1.c: Regenerated.
* generated/minloc1_8_i16.c: Regenerated.
* generated/minloc1_8_i2.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_i1.c: Regenerated.
* generated/minval_i16.c: Regenerated.
* generated/minval_i2.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_i1.c: Regenerated.
* generated/product_i16.c: Regenerated.
* generated/product_i2.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_i1.c: Regenerated.
* generated/sum_i16.c: Regenerated.
* generated/sum_i2.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.
2008-05-04 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/35995
* gfortran.dg/intrinsic_ifunction_1.f90: New test case.
From-SVN: r134934
Diffstat (limited to 'libgfortran/m4')
-rw-r--r-- | libgfortran/m4/ifunction.m4 | 10 | ||||
-rw-r--r-- | libgfortran/m4/ifunction_logical.m4 | 9 |
2 files changed, 14 insertions, 5 deletions
diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4 index 5ab2952..edf3c77 100644 --- a/libgfortran/m4/ifunction.m4 +++ b/libgfortran/m4/ifunction.m4 @@ -39,12 +39,15 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, index_type len; index_type delta; index_type dim; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; rank = GFC_DESCRIPTOR_RANK (array) - 1; len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; delta = array->dim[dim].stride; for (n = 0; n < dim; n++) @@ -131,7 +134,8 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, base = array->data; dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const atype_name * restrict src; rtype_name result; @@ -169,8 +173,8 @@ define(FINISH_ARRAY_FUNCTION, if (n == rank) { /* Break out of the look. */ - base = NULL; - break; + continue_loop = 0; + break; } else { diff --git a/libgfortran/m4/ifunction_logical.m4 b/libgfortran/m4/ifunction_logical.m4 index 8666870..a31d73a 100644 --- a/libgfortran/m4/ifunction_logical.m4 +++ b/libgfortran/m4/ifunction_logical.m4 @@ -40,6 +40,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, index_type delta; index_type dim; int src_kind; + int continue_loop; /* Make dim zero based to avoid confusion. */ dim = (*pdim) - 1; @@ -48,6 +49,9 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, src_kind = GFC_DESCRIPTOR_SIZE (array); len = array->dim[dim].ubound + 1 - array->dim[dim].lbound; + if (len < 0) + len = 0; + delta = array->dim[dim].stride * src_kind; for (n = 0; n < dim; n++) @@ -147,7 +151,8 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, dest = retarray->data; - while (base) + continue_loop = 1; + while (continue_loop) { const GFC_LOGICAL_1 * restrict src; rtype_name result; @@ -185,7 +190,7 @@ define(FINISH_ARRAY_FUNCTION, if (n == rank) { /* Break out of the look. */ - base = NULL; + continue_loop = 0; break; } else |