This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: minloc/minval on empty array
Hi,
Daniel Franke wrote:
> $> cat minloc.f90
> PRINT *, MINLOC((/ 42, 23 /), DIM=1, MASK=.FALSE.)
> END
>
> $> gfotran-4.2 -g -Wall minloc.f90 && ./a.out
> 1
> 2147483647
Same with 4.3.
This is a bug. From the Fortran 2003 standard (13.7.78 MINLOC):
"Case (ii) The result of MINLOC (ARRAY, MASK = MASK) is a rank-one array
[...]
If ARRAY has size zero or every element of MASK has the value false, all
elements of the result are zero."
"Case (iii) If ARRAY has rank one, MINLOC (ARRAY, DIM = DIM [, MASK =
MASK]) is a scalar whose value is equal to that of the first element of
MINLOC (ARRAY [, MASK = MASK])."
Can you fill a bugreport (including quoting this part of the standard)?
Tobias