summaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-12 19:59:17 +0000
committerfxcoudert <fxcoudert@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-12 19:59:17 +0000
commit0222d4de74e42cfc1de5479e641f262cd57afd9b (patch)
treecc455889003257c5b45220b191017d12068eceb5 /libgfortran
parent8d97f76285fac63114f6acf4e6fe3b6993b81ad0 (diff)
downloadgcc-0222d4de74e42cfc1de5479e641f262cd57afd9b.tar.gz
PR libfortran/19155
* io/read.c (read_f): Take care of spaces after initial sign. * gfortran.dg/pr19155.f: Add test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100861 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog5
-rw-r--r--libgfortran/io/read.c42
2 files changed, 27 insertions, 20 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 86a04e804b2..79e09f67042 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 1c8b3b0daa8..fbd38f13bec 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 == ' ')