$> cat minloc.f90 PRINT *, MINLOC((/ 42, 23 /), DIM=1, MASK=.FALSE.) PRINT *, MINVAL((/ 42, 23 /), DIM=1, MASK=.FALSE.) END
$> gfotran-4.2 -g -Wall minloc.f90 && ./a.out 1 2147483647 F2003, 13.7.78, MINLOC, Result Value: "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])." Thus, the result for MINLOC in above code should be zero. I'm not sure about MINVAL. The same problem exists with MAXLOC/MAXVAL. -- Summary: minloc/minval: wrong results with empty array Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dfranke at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31726