diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2017-12-03 20:14:05 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2017-12-03 20:14:05 +0000 |
commit | 0ac7425470a37554aa4dd017afb5f90b7328c9b0 (patch) | |
tree | b31908b5003acf7307242caf1ae5698a3d2a3fb9 /libgfortran/m4/minval1s.m4 | |
parent | af5ad1e2e56a91db15c1f714f5f513ad54a07eeb (diff) | |
download | gcc-0ac7425470a37554aa4dd017afb5f90b7328c9b0.zip gcc-0ac7425470a37554aa4dd017afb5f90b7328c9b0.tar.gz gcc-0ac7425470a37554aa4dd017afb5f90b7328c9b0.tar.bz2 |
re PR fortran/36313 ([F03] {MIN,MAX}{LOC,VAL} should accept character arguments)
2017-12-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36313
* check.c (gfc_check_minval_maxval): Use
int_orLreal_or_char_check_f2003 for array argument.
* iresolve.c (gfc_resolve_maxval): Insert number in
function name for character arguments.
(gfc_resolve_minval): Likewise.
* trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc):
Fix comment.
(gfc_conv_intrinsic_minmaxval): Resort arguments and call library
function if dealing with a character function.
2017-12-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36313
* Makefile.am: Add new files for character-valued
maxval and minval.
* Makefile.in: Regenerated.
* gfortran.map: Add new functions.
* m4/iforeach-s2.m4: New file.
* m4/ifunction-s2.m4: New file.
* m4/iparm.m4: Add intitval for minval and maxval.
* m4/maxval0s.m4: New file.
* m4/maxval1s.m4: New file.
* m4/minval0s.m4: New file.
* m4/minval1s.m4: New file.
* generated/maxval0_s1.c: New file.
* generated/maxval0_s4.c: New file.
* generated/maxval1_s1.c: New file.
* generated/maxval1_s4.c: New file.
* generated/minval0_s1.c: New file.
* generated/minval0_s4.c: New file.
* generated/minval1_s1.c: New file.
* generated/minval1_s4.c: New file.
2017-12-03 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/36313
* gfortran.dg/maxval_char_1.f90: New test.
* gfortran.dg/maxval_char_2.f90: New test.
* gfortran.dg/maxval_char_3.f90: New test.
* gfortran.dg/maxval_char_4.f90: New test.
* gfortran.dg/minval_char_1.f90: New test.
* gfortran.dg/minval_char_2.f90: New test.
* gfortran.dg/minval_char_3.f90: New test.
* gfortran.dg/minval_char_4.f90: New test.
From-SVN: r255367
Diffstat (limited to 'libgfortran/m4/minval1s.m4')
-rw-r--r-- | libgfortran/m4/minval1s.m4 | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/libgfortran/m4/minval1s.m4 b/libgfortran/m4/minval1s.m4 new file mode 100644 index 0000000..3f52bd9 --- /dev/null +++ b/libgfortran/m4/minval1s.m4 @@ -0,0 +1,61 @@ +`/* Implementation of the MAXVAL intrinsic + Copyright 2017 Free Software Foundation, Inc. + Contributed by Thomas Koenig + +This file is part of the GNU Fortran runtime library (libgfortran). + +Libgfortran is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public +License as published by the Free Software Foundation; either +version 3 of the License, or (at your option) any later version. + +Libgfortran is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +<http://www.gnu.org/licenses/>. */ + +#include "libgfortran.h"' + +include(iparm.m4)dnl +include(ifunction-s2.m4)dnl + +`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)' + +ARRAY_FUNCTION(255, +` const atype_name *retval; + retval = base;', +` if (compare_fcn (src, retval, string_len) < 0) + { + retval = src; + }', `') + +MASKED_ARRAY_FUNCTION(255, +` const atype_name *retval; + memset (dest, 255, sizeof (*dest) * string_len); + retval = dest;', +` if (*msrc) + { + retval = src; + break; + } + } + for (; n < len; n++, src += delta, msrc += mdelta) + { + if (*msrc && compare_fcn (src, retval, string_len) < 0) + { + retval = src; + } + ') + +SCALAR_ARRAY_FUNCTION(255) + +#endif |