[patch, Fortran, RFC] Implement library side of {MIN,MAX}{LOC,VAL} with character arguments

Thomas Koenig tkoenig@netcologne.de
Mon Sep 19 20:59:00 GMT 2011


Hello world,

this patch implements the library side of PR 36313, minloc and friends
on character arguments.

I haven't started tackling the inline versions yet.  I suspect that
these are easy for somebody who knows the scalarizer (not me :-) but
I'll start looking into how to do it.  Unless, of course, somebody
else wants to do it *HINT*

Any comments?  I was not planning on committing yet, because for the
more simple cases we actually hit an ICE with this patch instead of
a clean error message.

Regards

	Thomas

2011-09-19  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/36313
         * m4/foreach.m4 (slen_proto): New macro, for adding ',int ' in
         prototypes.  Use it throughout the file.
         (slen_def): New macro, for adding ', int slen' in function
         argument lists.  Use it throughout the file.
         (slen_use): New macro for optionally putting slen into an argument
         list.  Use it throughout the file.
         * m4/iparm.m4: Use 's' as letter for character functions.
         * m4/ifunction.m4 (slen_proto): New macro, for adding ',int ' in
         prototypes.  Use it throughout the file.
         (slen_def): New macro, for adding ', int slen' in function
         argument lists.  Use it throughout the file.
         (slen_use): New macro for optionally putting slen into an argument
         list.  Use it throughout the file.
         * gfortran.map: Add _gfortran_maxloc0_1_s1,
         _gfortran_maxloc0_2_s1, _gfortran_maxloc0_4_s1,
         _gfortran_maxloc0_8_s1, _gfortran_maxloc0_16_s1,
         _gfortran_maxloc0_1_s4, _gfortran_maxloc0_2_s4,
         _gfortran_maxloc0_4_s4, _gfortran_maxloc0_8_s4,
         _gfortran_maxloc0_16_s4, _gfortran_minloc0_1_s1,
         _gfortran_minloc0_2_s1, _gfortran_minloc0_4_s1,
         _gfortran_minloc0_8_s1, _gfortran_minloc0_16_s1,
         _gfortran_minloc0_1_s4, _gfortran_minloc0_2_s4,
         _gfortran_minloc0_4_s4, _gfortran_minloc0_8_s4,
         _gfortran_minloc0_16_s4, _gfortran_maxloc1_1_s1,
         _gfortran_maxloc1_2_s1, _gfortran_maxloc1_4_s1,
         _gfortran_maxloc1_8_s1, _gfortran_maxloc1_16_s1,
         _gfortran_maxloc1_1_s4, _gfortran_maxloc1_2_s4,
         _gfortran_maxloc1_4_s4, _gfortran_maxloc1_8_s4,
         _gfortran_maxloc1_16_s4, _gfortran_minloc1_1_s1,
         _gfortran_minloc1_2_s1, _gfortran_minloc1_4_s1,
         _gfortran_minloc1_8_s1, _gfortran_minloc1_16_s1,
         _gfortran_minloc1_1_s4, _gfortran_minloc1_2_s4,
         _gfortran_minloc1_4_s4, _gfortran_minloc1_8_s4,
         _gfortran_minloc1_16_s4, _gfortran_maxval_s1,
         _gfortran_maxval_s4, _gfortran_minval_s1,
         _gfortran_minval_s4.
         * libgfortran.h (gfc_array_s1):  Add type definition.
         (gfc_array_s4):  Add type definition.
         * Makefile.am (i_maxloc0s_c):  Add; also add dependencies.
         (i_maxloc1s_c):  Likewise.
         (i_maxvals_c):  Likewise.
         (i_minloc0s_c):  Likewise.
         (i_minloc1s_c):  Likewise.
         (i_minvals_c):  Likewise.
         * mk-kinds-h.sh:  Also emit HAVE_GFC_UINTEGER_* macros.
         * m4/ifunction-s.m4:  New file.
         * m4/maxloc0s.m4:  New file.
         * m4/maxloc1s.m4:  New file.
         * m4/maxvals.m4:  New file.
         * m4/minloc0s.m4:  New file.
         * m4/minloc1s.m4:  New file.
         * m4/minvals.m4:  New file.

2011-09-19  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/36313
         * frontend-passes.c (optimize_minmaxloc):  Don't optimize
         minloc/maxloc if the first argument is of type character.
         * check.c (int_or_real_or_char_check_2003):  New function.
         (gfc_check_minloc_maxloc):  Use it, instead of
         int_or_real_check.
         (gfc_check_minval_maxval):  Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p2a.diff
Type: text/x-patch
Size: 2477 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110919/4d333224/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p2.diff
Type: text/x-patch
Size: 14465 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110919/4d333224/attachment-0001.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ifunction-s.m4
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110919/4d333224/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: maxloc0s.m4
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110919/4d333224/attachment-0001.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: minloc1s.m4
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110919/4d333224/attachment-0002.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: minloc0s.m4
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110919/4d333224/attachment-0003.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: maxloc1s.m4
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110919/4d333224/attachment-0004.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: minvals.m4
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110919/4d333224/attachment-0005.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: maxvals.m4
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110919/4d333224/attachment-0006.ksh>


More information about the Gcc-patches mailing list