+2011-02-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR libgfortran/47567
+ * io/list_read.c (read_logical): Check for end of line before calling
+ eat_line. (read_integer): Likewise. (parse_real): Don't unget the
+ separator. Check for end of line before calling eat_line.
+ (read_complex): Allow line-end before and after parenthesis and comma.
+ Check for end of line before calling eat_line. (read_real): Check for
+ end of line before calling eat_line.
+
2011-02-16 Jakub Jelinek <jakub@redhat.com>
PR libfortran/47757
hit_eof (dtp);
return;
}
- else
+ else if (c != '\n')
eat_line (dtp);
sprintf (message, "Bad logical value while reading item %d",
dtp->u.p.item_count);
hit_eof (dtp);
return;
}
- else
+ else if (c != '\n')
eat_line (dtp);
sprintf (message, "Bad integer for item %d in list input",
dtp->u.p.item_count);
if ((c = next_char (dtp)) == EOF)
goto bad;
+
if (c == '-' || c == '+')
{
push_char (dtp, c);
goto exp2;
CASE_SEPARATORS:
- unget_char (dtp, c);
goto done;
default:
hit_eof (dtp);
return 1;
}
- else
+ else if (c != '\n')
eat_line (dtp);
sprintf (message, "Bad floating point number for item %d",
dtp->u.p.item_count);
goto bad_complex;
}
+eol_1:
eat_spaces (dtp);
+ c = next_char (dtp);
+ if (c == '\n' || c== '\r')
+ goto eol_1;
+ else
+ unget_char (dtp, c);
+
if (parse_real (dtp, dest, kind))
return;
-eol_1:
+eol_2:
eat_spaces (dtp);
c = next_char (dtp);
if (c == '\n' || c== '\r')
- goto eol_1;
+ goto eol_2;
else
unget_char (dtp, c);
!= (dtp->u.p.current_unit->decimal_status == DECIMAL_POINT ? ',' : ';'))
goto bad_complex;
-eol_2:
+eol_3:
eat_spaces (dtp);
c = next_char (dtp);
if (c == '\n' || c== '\r')
- goto eol_2;
+ goto eol_3;
else
unget_char (dtp, c);
if (parse_real (dtp, dest + size / 2, kind))
return;
-
+
+eol_4:
eat_spaces (dtp);
+ c = next_char (dtp);
+ if (c == '\n' || c== '\r')
+ goto eol_4;
+ else
+ unget_char (dtp, c);
+
if (next_char (dtp) != ')')
goto bad_complex;
hit_eof (dtp);
return;
}
- else
+ else if (c != '\n')
eat_line (dtp);
sprintf (message, "Bad complex value in item %d of list input",
dtp->u.p.item_count);
hit_eof (dtp);
return;
}
- else
+ else if (c != '\n')
eat_line (dtp);
+
sprintf (message, "Bad real number in item %d of list input",
dtp->u.p.item_count);
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);