http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613
Bug #: 54613 Summary: [F2003/F2008] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK= Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org Fortran 2003 (cf. PR 29600) added KIND= to MINLOC/MAXLOC, Fortran 2008 added BACK=. Additionally, Fortran 2008 added FINDLOC with a similar syntax. See also James' post in "binary data" https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/GpaACNKn0Ds "As can be seen from the commented out code, gfortran does not yet implement the BACK= argument for the MAXLOC and MINLOC intrinsics, doesn't yet implement MAXLOC, MAXVAL, MINLOC, MINVAL for constant expressions and doesn't implement FINDLOC at all." See also his comments in https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/5eAz5ns6AG0 The first step is to implement the run-time version, i.e. extending MINLOC/MAXLOC and adding FINDLOC. (trans-intrinsic.c version, frontend-optimization.c and the library version, possibly such that one doesn't cause an explosion of the intrinsics, e.g. only returning default + index-type? If so, one needs to have a RANGE_REF copy for the array results - and for the MASK argument.) As a next step, one has to think of the compile-time simplification of {MIN,MAX}{VAL,LOC},FINDLOC.