diff options
author | Dominique d'Humieres <dominiq@lps.ens.fr> | 2018-01-06 20:09:52 +0100 |
---|---|---|
committer | Janne Blomqvist <jb@gcc.gnu.org> | 2018-01-06 21:09:52 +0200 |
commit | d9bb51cdd3a22baa705228733ff0995aabd9407c (patch) | |
tree | 3b46dc14d9d91f2867f24fde1fd7e2e2db792190 /libgfortran | |
parent | b4c969723c1e61dbdaadc61b0b5fd5393e9ff76e (diff) | |
download | gcc-d9bb51cdd3a22baa705228733ff0995aabd9407c.zip gcc-d9bb51cdd3a22baa705228733ff0995aabd9407c.tar.gz gcc-d9bb51cdd3a22baa705228733ff0995aabd9407c.tar.bz2 |
PR 83704 Use size_t in write_character
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
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 7 | ||||
-rw-r--r-- | libgfortran/io/write.c | 10 |
2 files changed, 12 insertions, 5 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index af1cb29..f0c151d 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +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 diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index c04d243..32abbd6 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1358,9 +1358,9 @@ write_integer (st_parameter_dt *dtp, const char *source, int kind) #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) @@ -1389,7 +1389,7 @@ write_character (st_parameter_dt *dtp, const char *source, int kind, int length, { extra = 2; - for (i = 0; i < length; i++) + for (size_t i = 0; i < length; i++) if (source[i] == d) extra++; } @@ -1409,7 +1409,7 @@ write_character (st_parameter_dt *dtp, const char *source, int kind, int length, { *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) @@ -1427,7 +1427,7 @@ write_character (st_parameter_dt *dtp, const char *source, int kind, int length, { *p++ = d; - for (i = 0; i < length; i++) + for (size_t i = 0; i < length; i++) { *p++ = source[i]; if (source[i] == d) |