diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-06-12 21:59:17 +0200 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-06-12 19:59:17 +0000 |
commit | 57504df9ee4a500f71fd9f656b4ad278b3dbbb97 (patch) | |
tree | cc455889003257c5b45220b191017d12068eceb5 /libgfortran | |
parent | d35310e309872f99917cb3d7dc67abd63023d33c (diff) | |
download | gcc-57504df9ee4a500f71fd9f656b4ad278b3dbbb97.zip gcc-57504df9ee4a500f71fd9f656b4ad278b3dbbb97.tar.gz gcc-57504df9ee4a500f71fd9f656b4ad278b3dbbb97.tar.bz2 |
re PR libfortran/19155 ([4.0 only] blanks not treated as zeros in 'E' format read (NIST FM110.FOR))
PR libfortran/19155
* io/read.c (read_f): Take care of spaces after initial sign.
* gfortran.dg/pr19155.f: Add test.
From-SVN: r100861
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 5 | ||||
-rw-r--r-- | libgfortran/io/read.c | 42 |
2 files changed, 27 insertions, 20 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 86a04e8..79e09f6 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2005-06-12 Francois-Xavier Coudert <coudert@clipper.ens.fr> + + PR libfortran/19155 + * io/read.c (read_f): Take care of spaces after initial sign. + 2005-06-09 Thomas Koenig <Thomas.Koenig@online.de> PR libfortran/21480 diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c index 1c8b3b0..fbd38f1 100644 --- a/libgfortran/io/read.c +++ b/libgfortran/io/read.c @@ -504,23 +504,7 @@ read_f (fnode * f, char *dest, int length) p = eat_leading_spaces (&w, p); if (w == 0) - { - switch (length) - { - case 4: - *((float *) dest) = 0.0f; - break; - - case 8: - *((double *) dest) = 0.0; - break; - - default: - internal_error ("Unsupported real kind during IO"); - } - - return; - } + goto zero; /* Optional sign */ @@ -529,12 +513,13 @@ read_f (fnode * f, char *dest, int length) if (*p == '-') val_sign = -1; p++; - - if (--w == 0) - goto bad_float; + w--; } exponent_sign = 1; + p = eat_leading_spaces (&w, p); + if (w == 0) + goto zero; /* A digit, a '.' or a exponent character ('e', 'E', 'd' or 'D') is required at this point */ @@ -604,6 +589,23 @@ read_f (fnode * f, char *dest, int length) generate_error (ERROR_READ_VALUE, "Bad value during floating point read"); return; + /* The value read is zero */ + zero: + switch (length) + { + case 4: + *((float *) dest) = 0.0f; + break; + + case 8: + *((double *) dest) = 0.0; + break; + + default: + internal_error ("Unsupported real kind during IO"); + } + return; + /* At this point the start of an exponent has been found */ exp1: while (w > 0 && *p == ' ') |