This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gfortran] Fix {MIN|MAX}LOC


Patch below make the minloc and maxloc intrinsics work when all values are 
equal to the extreme value. Part of PR/12704.

Applied to tree-ssa branch.

Paul

2003-11-06  Paul Brook  <paul@nowt.org>

	* trans-intrinsic.c (gfc_conv_intrinsics_minmaxloc): Initialize pos.
testsuite
	* gfortran.fortran-toriture/execute/intrinsic_mmloc_3.f90: New test.

--- clean/tree-ssa/gcc/fortran/trans-intrinsic.c	2003-10-17 
19:52:30.000000000 +0100
+++ gcc/gcc/fortran/trans-intrinsic.c	2003-11-06 20:40:12.000000000 +0000
@@ -1370,6 +1370,10 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * s
 
   assert (loop.dimen == 1);
 
+  /* Initialize the position to the first element.  This is neccessary
+     when all the values are equal to the limit.  */
+  gfc_add_modify_expr (&loop.pre, pos, loop.from[0]);
+      
   gfc_mark_ss_chain_used (arrayss, 1);
   if (maskss)
     gfc_mark_ss_chain_used (maskss, 1);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]