summaryrefslogtreecommitdiff
path: root/libgfortran/m4
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2008-05-04 19:07:28 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2008-05-04 19:07:28 +0000
commitda96f5ab49d8e45bdca0d08c5ecc408ddbc3de47 (patch)
treeb2ffeecf45cdd998f85c6ea3842a5747af150b22 /libgfortran/m4
parent62d2739afd9e0b8cea92edae521222930b67743d (diff)
downloadgcc-da96f5ab49d8e45bdca0d08c5ecc408ddbc3de47.tar.gz
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.m410
-rw-r--r--libgfortran/m4/ifunction_logical.m49
2 files changed, 14 insertions, 5 deletions
diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4
index 5ab2952a491..edf3c77d05c 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 8666870c88e..a31d73a17b9 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