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]

Re: MINLOC/MAXLOC


On Wed, Jan 06, 2016 at 09:42:15PM -0800, Damian Rouson wrote:
> 
> Isnât PR 54613 low-hanging fruit and therefore a relatively
> painless way to eliminate 2 of the 6 red boxes on the Fortran
> 2008 status page (https://gcc.gnu.org/wiki/Fortran2008Status)?
> 
> Anybody game?
> 

I think you need to define "low-hanging fruit". :-)

There are 54 generated files for maxloc and 54 generated files
of minloc in libgfortran/generated.  These come from m4/minloc0.m4,
m4/minloc1.m4, m4/maxloc0.m4, and m4/maxloc1.m4.  Each of these
contains 3 functions, for example,

% grep -E ^export maxloc0_4_r4.c  <-- DIM is not present
export_proto(maxloc0_4_r4);       <-- MASK is not present
export_proto(mmaxloc0_4_r4);      <-- MASK is array
export_proto(smaxloc0_4_r4);      <-- MASK is scalar
% grep -E ^export maxloc1_4_r4.c  <-- DIM is present
export_proto(maxloc1_4_r4);       <-- MASK is not present
export_proto(mmaxloc1_4_r4);      <-- MASK is array
export_proto(smaxloc1_4_r4);      <-- MASK is scalar

There is the additional complication that gfortran generates
inline code for rank 1 ARRAY.  Thesei functions return a default
integer kind (ie., _4 in funtion names).  To support KIND from
F2003 requires the injection of type conversion for INTEGER(1)
and INTEGER(2) or an explosion in library routines.  Note, gfortran 
already has, for example, maxloc0_8_r4.c and maxloc0_16_r4.c
for INTEGER(8) and INTEGER(16) return kind types, but the
functions contained within these files can never be called
because gfc_resolve_maxloc() assumes only an INTEGER(4) return
type.

Adding BACK would require adding a 'bool back' to each of the
*.m4 files and the code needed to deal with whatever back==true
does.  The inline rank 1 ARRAY would also need to be updated
to deal with BACK.

-- 
Steve


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