diff options
author | Jerry DeLisle <jvdelisle@verizon.net> | 2005-07-09 23:40:31 +0000 |
---|---|---|
committer | Jerry DeLisle <jvdelisle@gcc.gnu.org> | 2005-07-09 23:40:31 +0000 |
commit | 9fa276de85bb001784c07c21ba291d85c2fcd710 (patch) | |
tree | 503ede726a28e4a251771117cb4154ae761a6fb1 /libgfortran | |
parent | f685a2e68d5f87b7eb3b9e7119c7abb9e4304672 (diff) | |
download | gcc-9fa276de85bb001784c07c21ba291d85c2fcd710.zip gcc-9fa276de85bb001784c07c21ba291d85c2fcd710.tar.gz gcc-9fa276de85bb001784c07c21ba291d85c2fcd710.tar.bz2 |
PR libfortran/21875 (FM111.f)
2005-07-09 Jerry DeLisle <jvdelisle@verizon.net>
PR libfortran/21875 (FM111.f)
* io/read.c (next_char): Return a ' ' character when BLANK_ZERO or
BLANK_NULL are active.
(read_decimal): Interpret ' ' character correctly for BZ or BN.
(read_radix): Interpret ' ' character correctly for BZ or BN.
(read_f): Interpret ' ' character correctly for BZ or BN.
* gfortran.dg/test (fmt_read_bz_bn.f90): New test case.
From-SVN: r101837
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 11 | ||||
-rw-r--r-- | libgfortran/io/read.c | 58 |
2 files changed, 50 insertions, 19 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index a73202d..8457da4 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,14 @@ + +2005-07-09 Jerry DeLisle <jvdelisle@verizon.net> + + PR libfortran/21875 (FM111.f) + * io/read.c (next_char): Return a ' ' character when BLANK_ZERO or + BLANK_NULL are active. + (read_decimal): Interpret ' ' character correctly for BZ or BN. + (read_radix): Interpret ' ' character correctly for BZ or BN. + (read_f): Interpret ' ' character correctly for BZ or BN. + * gfortran.dg/test (fmt_read_bz_bn.f90): New test case. + 2005-07-09 Francois-Xavier Coudert <coudert@clipper.ens.fr> Thomas Koenig <Thomas.Koenig@online.de> diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c index 2eb68c8..101652c 100644 --- a/libgfortran/io/read.c +++ b/libgfortran/io/read.c @@ -266,8 +266,8 @@ next_char (char **p, int *w) if (c != ' ') return c; - if (g.blank_status == BLANK_ZERO) - return '0'; + if (g.blank_status != BLANK_UNSPECIFIED) + return ' '; /* return a blank to signal a null */ /* At this point, the rest of the field has to be trailing blanks */ @@ -336,7 +336,13 @@ read_decimal (fnode * f, char *dest, int length) c = next_char (&p, &w); if (c == '\0') break; - + + if (c == ' ') + { + if (g.blank_status == BLANK_NULL) continue; + if (g.blank_status == BLANK_ZERO) c = '0'; + } + if (c < '0' || c > '9') goto bad; @@ -424,6 +430,11 @@ read_radix (fnode * f, char *dest, int length, int radix) c = next_char (&p, &w); if (c == '\0') break; + if (c == ' ') + { + if (g.blank_status == BLANK_NULL) continue; + if (g.blank_status == BLANK_ZERO) c = '0'; + } switch (radix) { @@ -680,19 +691,22 @@ read_f (fnode * f, char *dest, int length) p++; w--; - while (w > 0 && isdigit (*p)) - { - exponent = 10 * exponent + *p - '0'; - p++; - w--; - } - - /* Only allow trailing blanks */ - while (w > 0) { - if (*p != ' ') - goto bad_float; + if (*p == ' ') + { + if (g.blank_status == BLANK_ZERO) *p = '0'; + if (g.blank_status == BLANK_NULL) + { + p++; + w--; + continue; + } + } + if (!isdigit (*p)) + goto bad_float; + + exponent = 10 * exponent + *p - '0'; p++; w--; } @@ -732,16 +746,22 @@ read_f (fnode * f, char *dest, int length) buffer = get_mem (i); /* Reformat the string into a temporary buffer. As we're using atof it's - easiest to just leave the dcimal point in place. */ + easiest to just leave the decimal point in place. */ p = buffer; if (val_sign < 0) *(p++) = '-'; for (; ndigits > 0; ndigits--) { - if (*digits == ' ' && g.blank_status == BLANK_ZERO) - *p = '0'; - else - *p = *digits; + if (*digits == ' ') + { + if (g.blank_status == BLANK_ZERO) *digits = '0'; + if (g.blank_status == BLANK_NULL) + { + digits++; + continue; + } + } + *p = *digits; p++; digits++; } |