aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/io/read.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgfortran/io/read.c')
-rw-r--r--libgfortran/io/read.c60
1 files changed, 42 insertions, 18 deletions
diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c
index 4cfad8d..654475d 100644
--- a/libgfortran/io/read.c
+++ b/libgfortran/io/read.c
@@ -691,24 +691,46 @@ read_f (fnode * f, char *dest, int length)
p++;
w--;
- while (w > 0)
+ if (g.blank_status == BLANK_UNSPECIFIED) /* Normal processing of exponent */
{
- if (*p == ' ')
+ while (w > 0 && isdigit (*p))
{
- if (g.blank_status == BLANK_ZERO) *p = '0';
- if (g.blank_status == BLANK_NULL)
+ exponent = 10 * exponent + *p - '0';
+ p++;
+ w--;
+ }
+
+ /* Only allow trailing blanks */
+
+ while (w > 0)
+ {
+ if (*p != ' ')
+ goto bad_float;
+ p++;
+ w--;
+ }
+ }
+ else /* BZ or BN status is enabled */
+ {
+ while (w > 0)
+ {
+ if (*p == ' ')
{
- p++;
- w--;
- continue;
+ if (g.blank_status == BLANK_ZERO) *p = '0';
+ if (g.blank_status == BLANK_NULL)
+ {
+ p++;
+ w--;
+ continue;
+ }
}
+ else if (!isdigit (*p))
+ goto bad_float;
+
+ exponent = 10 * exponent + *p - '0';
+ p++;
+ w--;
}
- if (!isdigit (*p))
- goto bad_float;
-
- exponent = 10 * exponent + *p - '0';
- p++;
- w--;
}
exponent = exponent * exponent_sign;
@@ -784,12 +806,14 @@ read_f (fnode * f, char *dest, int length)
void
read_x (fnode * f)
{
- int n, m;
+ int n;
n = f->u.n;
- m = (int)current_unit->bytes_left;
- if (f->format == FMT_X)
- n = (n > m) ? m : n;
- if (n)
+
+ if ((current_unit->flags.pad == PAD_NO || is_internal_unit ())
+ && current_unit->bytes_left < n)
+ n = current_unit->bytes_left;
+
+ if (n > 0)
read_block (&n);
}