diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2006-03-13 22:49:56 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2006-03-13 22:49:56 +0000 |
commit | a4b9e93e5d35d44cc1d13680800c36065e2cbd3e (patch) | |
tree | c9b7df7a9552d154d8cf7e2055c0a2c433188f18 /libgfortran/m4 | |
parent | 94c5a84153af895ba99c7de5ebd2448e4d80c4d5 (diff) | |
download | gcc-a4b9e93e5d35d44cc1d13680800c36065e2cbd3e.zip gcc-a4b9e93e5d35d44cc1d13680800c36065e2cbd3e.tar.gz gcc-a4b9e93e5d35d44cc1d13680800c36065e2cbd3e.tar.bz2 |
re PR libfortran/25378 ([Fortran 2003] maxloc for all-false mask)
2006-03-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25378
* trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): Set the initial position to zero and
modify the condition for updating it, to implement the F2003 requirement for all(mask)
is false.
2006-03-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25378
* libgfortran/m4/minloc1.m4: Set the initial position to zero and modify the condition for
updating it, to implement the F2003 requirement for all(mask).eq.false.
* libgfortran/m4/maxloc1.m4: The same.
* libgfortran/m4/iforeach.m4: The same.
* libgfortran/m4/minloc0.m4: The same.
* libgfortran/m4/maxloc0.m4: The same.
* libgfortran/generated/maxloc0_16_i16.c: Regenerated, together with 41 others.
* libgfortran/generated/minloc0_16_i16.c: Regenerated, together with 41 others.
2006-03-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25378
* gfortran.fortran-torture/execute/intrinsic_mmloc_3.f90: Expand test to include more
permuatations of mask and index.
* testsuite/gfortran.dg/scalar_mask_1.f90: Modify last test to respond to F2003 spec.
that the position returned for an all false mask && condition is zero.
From-SVN: r112028
Diffstat (limited to 'libgfortran/m4')
-rw-r--r-- | libgfortran/m4/iforeach.m4 | 4 | ||||
-rw-r--r-- | libgfortran/m4/maxloc0.m4 | 4 | ||||
-rw-r--r-- | libgfortran/m4/maxloc1.m4 | 8 | ||||
-rw-r--r-- | libgfortran/m4/minloc0.m4 | 4 | ||||
-rw-r--r-- | libgfortran/m4/minloc1.m4 | 8 |
5 files changed, 14 insertions, 14 deletions
diff --git a/libgfortran/m4/iforeach.m4 b/libgfortran/m4/iforeach.m4 index 8c5ebc9..cfe5639 100644 --- a/libgfortran/m4/iforeach.m4 +++ b/libgfortran/m4/iforeach.m4 @@ -71,7 +71,7 @@ name`'rtype_qual`_'atype_code (rtype * const restrict retarray, /* Initialize the return value. */ for (n = 0; n < rank; n++) - dest[n * dstride] = 1; + dest[n * dstride] = 0; { ')dnl define(START_FOREACH_BLOCK, @@ -198,7 +198,7 @@ void /* Initialize the return value. */ for (n = 0; n < rank; n++) - dest[n * dstride] = 1; + dest[n * dstride] = 0; { ')dnl define(START_MASKED_FOREACH_BLOCK, `START_FOREACH_BLOCK')dnl diff --git a/libgfortran/m4/maxloc0.m4 b/libgfortran/m4/maxloc0.m4 index 8708a78..9feaa4b 100644 --- a/libgfortran/m4/maxloc0.m4 +++ b/libgfortran/m4/maxloc0.m4 @@ -45,7 +45,7 @@ FOREACH_FUNCTION( maxval = atype_min;' , -` if (*base > maxval) +` if (*base > maxval || !dest[0]) { maxval = *base; for (n = 0; n < rank; n++) @@ -57,7 +57,7 @@ MASKED_FOREACH_FUNCTION( maxval = atype_min;' , -` if (*mbase && *base > maxval) +` if (*mbase && (*base > maxval || !dest[0])) { maxval = *base; for (n = 0; n < rank; n++) diff --git a/libgfortran/m4/maxloc1.m4 b/libgfortran/m4/maxloc1.m4 index d1ea9dc..16136848 100644 --- a/libgfortran/m4/maxloc1.m4 +++ b/libgfortran/m4/maxloc1.m4 @@ -43,8 +43,8 @@ include(ifunction.m4)dnl ARRAY_FUNCTION(0, ` atype_name maxval; maxval = atype_min; - result = 1;', -` if (*src > maxval) + result = 0;', +` if (*src > maxval || !result) { maxval = *src; result = (rtype_name)n + 1; @@ -53,8 +53,8 @@ ARRAY_FUNCTION(0, MASKED_ARRAY_FUNCTION(0, ` atype_name maxval; maxval = atype_min; - result = 1;', -` if (*msrc && *src > maxval) + result = 0;', +` if (*msrc && (*src > maxval || !result)) { maxval = *src; result = (rtype_name)n + 1; diff --git a/libgfortran/m4/minloc0.m4 b/libgfortran/m4/minloc0.m4 index 10fb3a9..1c2aa18 100644 --- a/libgfortran/m4/minloc0.m4 +++ b/libgfortran/m4/minloc0.m4 @@ -45,7 +45,7 @@ FOREACH_FUNCTION( minval = atype_max;' , -` if (*base < minval) +` if (*base < minval || !dest[0]) { minval = *base; for (n = 0; n < rank; n++) @@ -57,7 +57,7 @@ MASKED_FOREACH_FUNCTION( minval = atype_max;' , -` if (*mbase && *base < minval) +` if (*mbase && (*base < minval || !dest[0])) { minval = *base; for (n = 0; n < rank; n++) diff --git a/libgfortran/m4/minloc1.m4 b/libgfortran/m4/minloc1.m4 index a224b73..0c116eb 100644 --- a/libgfortran/m4/minloc1.m4 +++ b/libgfortran/m4/minloc1.m4 @@ -43,8 +43,8 @@ include(ifunction.m4)dnl ARRAY_FUNCTION(0, ` atype_name minval; minval = atype_max; - result = 1;', -` if (*src < minval) + result = 0;', +` if (*src < minval || !result) { minval = *src; result = (rtype_name)n + 1; @@ -53,8 +53,8 @@ ARRAY_FUNCTION(0, MASKED_ARRAY_FUNCTION(0, ` atype_name minval; minval = atype_max; - result = 1;', -` if (*msrc && *src < minval) + result = 0;', +` if (*msrc && (*src < minval || !result)) { minval = *src; result = (rtype_name)n + 1; |