[Patch, fortran] PR25378 - [Fortran 2003] maxloc for all-false mask
Paul Thomas
paulthomas2@wanadoo.fr
Wed Mar 8 23:25:00 GMT 2006
:ADDPATCH fortran:
This patch replaces the F95 processor dependent result for min/maxloc,
in the event where the masks are all false, with the F2003 requirement
that the result is zero. Previously, gfortran returned 1. Either is
acceptable for F95 so it seems as well to implement Thomas Koenig's
suggestion. This is also consistent with commercial compilers.
The logic is:
set initial index = 0 /* was 1 */
if (the max/min condition is met or index = 0) /* rhs of or has been added */
{
set index to the current position
update the value for comparison
}
I have modified and extended the existing testcases and see no reason to
add any more.
Regtested on FC3/Athlon. OK for 4.1 and 4.2?
Paul
2006-03-09 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-09 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-09 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.
PS I can list all 84 permutations of min/maxloc, if necessary but cannot
see the value of it.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: minmaxloc.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060308/f8396311/attachment.ksh>
More information about the Fortran
mailing list