For printing long characters, we need to use size_t instead of int in
the argument to write_character.
Regtested on x86_64-pc-linux-gnu, approved in the PR, committed to
trunk.
libgfortran/ChangeLog:
2018-01-06 Dominique d'Humieres <dominiq@lps.ens.fr>
Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/83704
* io/write.c (write_character): Use size_t instead of int for
length.
Co-Authored-By: Janne Blomqvist <jb@gcc.gnu.org>
From-SVN: r256313
+2018-01-06 Dominique d'Humieres <dominiq@lps.ens.fr>
+ Janne Blomqvist <jb@gcc.gnu.org>
+
+ PR fortran/83704
+ * io/write.c (write_character): Use size_t instead of int for
+ length.
+
2019-01-05 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/78534
#define NODELIM 0
static void
-write_character (st_parameter_dt *dtp, const char *source, int kind, int length, int mode)
+write_character (st_parameter_dt *dtp, const char *source, int kind, size_t length, int mode)
{
- int i, extra;
+ size_t extra;
char *p, d;
if (mode == DELIM)
{
extra = 2;
- for (i = 0; i < length; i++)
+ for (size_t i = 0; i < length; i++)
if (source[i] == d)
extra++;
}
{
*p4++ = d4;
- for (i = 0; i < length; i++)
+ for (size_t i = 0; i < length; i++)
{
*p4++ = (gfc_char4_t) source[i];
if (source[i] == d)
{
*p++ = d;
- for (i = 0; i < length; i++)
+ for (size_t i = 0; i < length; i++)
{
*p++ = source[i];
if (source[i] == d)