User account creation filtered due to spam.

Bug 36313 - [F03] {MIN,MAX}{LOC,VAL} should accept character arguments
Summary: [F03] {MIN,MAX}{LOC,VAL} should accept character arguments
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
: 38951 43006 (view as bug list)
Depends on:
Blocks: 20585
  Show dependency treegraph
 
Reported: 2008-05-23 12:46 UTC by Francois-Xavier Coudert
Modified: 2016-08-09 06:18 UTC (History)
6 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-05-25 20:03:26


Attachments
patch doing maxloc0* at least. (3.93 KB, patch)
2011-08-26 00:06 UTC, Thomas Koenig
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2008-05-23 12:46:51 UTC
Starting with Fortran 2003, MINVAL, MAXVAL, MINLOC and MAXLOC accept character arguments. (Also, when implementing this, please remember to support wide characters!)
Comment 1 Thomas Koenig 2008-05-25 20:03:26 UTC
This should be fun :-)
Comment 2 Thomas Koenig 2008-06-04 19:06:14 UTC
No time for now (Real Time is catching up with me big time).

Unassigning (for now).
Comment 3 Daniel Franke 2009-01-03 23:02:57 UTC
Patch at
    http://gcc.gnu.org/ml/fortran/2009-01/msg00010.html
impliments simplifiers for MINVAL/MAXVAL and character arguments.
Comment 4 Daniel Franke 2009-01-24 09:51:13 UTC
*** Bug 38951 has been marked as a duplicate of this bug. ***
Comment 5 Daniel Franke 2010-02-09 13:10:14 UTC
*** Bug 43006 has been marked as a duplicate of this bug. ***
Comment 6 Thomas Koenig 2011-08-26 00:06:48 UTC
Created attachment 25108 [details]
patch doing maxloc0* at least.

Still missing: A lot, like minloc*, maxloc1*, etc.

Also: Don't forget the inlined versions, that should be fun too.
Comment 7 Bil Kleb 2014-12-09 18:26:57 UTC
Hi,

Regression or documentation skew?

Per 4.4.5 documentation, viz.,

  https://gcc.gnu.org/onlinedocs/gcc-4.4.5/gfortran/MINLOC.html

the MINLOC ARRAY argument could be INTEGER, REAL, or CHARACTER;
but as of 4.9.1, this is no longer the case?

$ cat > test_char_maxloc.f90 << EOF
program test_f2003_minloc_char
  character(20), dimension(5) :: strings
  data strings / 'close', 'closer', 'find_my_index', 'far', 'farther' /
  print*,sum(minloc(strings,strings=='find_my_index'))
end program
EOF

$ gfortran --version | head -1
GNU Fortran (Homebrew gcc 4.9.1) 4.9.1

$ gfortran test_char_maxloc.f90
test_char_maxloc.f90:4.20:

  print*,sum(minloc(strings,strings=='find_my_index'))
                    1
Error: 'array' argument of 'minloc' intrinsic at (1) must be INTEGER or REAL

And wasn't the case at 4.4.7:

$ gfortran --version | head -1
GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)

$ gfortran test_char_maxloc.f90 
test_char_maxloc.f90:4.20:

  print*,sum(minloc(strings,strings=='find_my_index'))
                    1
Error: 'array' argument of 'minloc' intrinsic at (1) must be INTEGER or REAL
Comment 8 Dominique d'Humieres 2014-12-09 18:57:30 UTC
> Regression or documentation skew?
>
> Per 4.4.5 documentation, viz.,

This has been changed starting at 4.5.4 up to trunk (5.0):

ARRAY	Shall be an array of type INTEGER or REAL. 

Note that I did not have the patience to check all the revisions in between for the four combinations of {MIN,MAX}{LOC,VAL} (if you want to do it, be my guest!-).

AFAICT these F2003 intrinsics have never been implemented. If you have the man power to do it, please feel free to contribute.