mirror of git://gcc.gnu.org/git/gcc.git
re PR libfortran/47567 (Wrong output for small absolute values with F editing)
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. From-SVN: r170239
This commit is contained in:
parent
18b08cb9eb
commit
fc2c5998f7
|
|
@ -1,3 +1,13 @@
|
||||||
|
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>
|
2011-02-16 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR libfortran/47757
|
PR libfortran/47757
|
||||||
|
|
|
||||||
|
|
@ -768,7 +768,7 @@ read_logical (st_parameter_dt *dtp, int length)
|
||||||
hit_eof (dtp);
|
hit_eof (dtp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else if (c != '\n')
|
||||||
eat_line (dtp);
|
eat_line (dtp);
|
||||||
sprintf (message, "Bad logical value while reading item %d",
|
sprintf (message, "Bad logical value while reading item %d",
|
||||||
dtp->u.p.item_count);
|
dtp->u.p.item_count);
|
||||||
|
|
@ -906,7 +906,7 @@ read_integer (st_parameter_dt *dtp, int length)
|
||||||
hit_eof (dtp);
|
hit_eof (dtp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else if (c != '\n')
|
||||||
eat_line (dtp);
|
eat_line (dtp);
|
||||||
sprintf (message, "Bad integer for item %d in list input",
|
sprintf (message, "Bad integer for item %d in list input",
|
||||||
dtp->u.p.item_count);
|
dtp->u.p.item_count);
|
||||||
|
|
@ -1104,6 +1104,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
|
||||||
|
|
||||||
if ((c = next_char (dtp)) == EOF)
|
if ((c = next_char (dtp)) == EOF)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
|
||||||
if (c == '-' || c == '+')
|
if (c == '-' || c == '+')
|
||||||
{
|
{
|
||||||
push_char (dtp, c);
|
push_char (dtp, c);
|
||||||
|
|
@ -1162,7 +1163,6 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
|
||||||
goto exp2;
|
goto exp2;
|
||||||
|
|
||||||
CASE_SEPARATORS:
|
CASE_SEPARATORS:
|
||||||
unget_char (dtp, c);
|
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -1273,7 +1273,7 @@ parse_real (st_parameter_dt *dtp, void *buffer, int length)
|
||||||
hit_eof (dtp);
|
hit_eof (dtp);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else
|
else if (c != '\n')
|
||||||
eat_line (dtp);
|
eat_line (dtp);
|
||||||
sprintf (message, "Bad floating point number for item %d",
|
sprintf (message, "Bad floating point number for item %d",
|
||||||
dtp->u.p.item_count);
|
dtp->u.p.item_count);
|
||||||
|
|
@ -1310,10 +1310,6 @@ read_complex (st_parameter_dt *dtp, void * dest, int kind, size_t size)
|
||||||
goto bad_complex;
|
goto bad_complex;
|
||||||
}
|
}
|
||||||
|
|
||||||
eat_spaces (dtp);
|
|
||||||
if (parse_real (dtp, dest, kind))
|
|
||||||
return;
|
|
||||||
|
|
||||||
eol_1:
|
eol_1:
|
||||||
eat_spaces (dtp);
|
eat_spaces (dtp);
|
||||||
c = next_char (dtp);
|
c = next_char (dtp);
|
||||||
|
|
@ -1322,9 +1318,8 @@ eol_1:
|
||||||
else
|
else
|
||||||
unget_char (dtp, c);
|
unget_char (dtp, c);
|
||||||
|
|
||||||
if (next_char (dtp)
|
if (parse_real (dtp, dest, kind))
|
||||||
!= (dtp->u.p.current_unit->decimal_status == DECIMAL_POINT ? ',' : ';'))
|
return;
|
||||||
goto bad_complex;
|
|
||||||
|
|
||||||
eol_2:
|
eol_2:
|
||||||
eat_spaces (dtp);
|
eat_spaces (dtp);
|
||||||
|
|
@ -1334,10 +1329,29 @@ eol_2:
|
||||||
else
|
else
|
||||||
unget_char (dtp, c);
|
unget_char (dtp, c);
|
||||||
|
|
||||||
|
if (next_char (dtp)
|
||||||
|
!= (dtp->u.p.current_unit->decimal_status == DECIMAL_POINT ? ',' : ';'))
|
||||||
|
goto bad_complex;
|
||||||
|
|
||||||
|
eol_3:
|
||||||
|
eat_spaces (dtp);
|
||||||
|
c = next_char (dtp);
|
||||||
|
if (c == '\n' || c== '\r')
|
||||||
|
goto eol_3;
|
||||||
|
else
|
||||||
|
unget_char (dtp, c);
|
||||||
|
|
||||||
if (parse_real (dtp, dest + size / 2, kind))
|
if (parse_real (dtp, dest + size / 2, kind))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
eol_4:
|
||||||
eat_spaces (dtp);
|
eat_spaces (dtp);
|
||||||
|
c = next_char (dtp);
|
||||||
|
if (c == '\n' || c== '\r')
|
||||||
|
goto eol_4;
|
||||||
|
else
|
||||||
|
unget_char (dtp, c);
|
||||||
|
|
||||||
if (next_char (dtp) != ')')
|
if (next_char (dtp) != ')')
|
||||||
goto bad_complex;
|
goto bad_complex;
|
||||||
|
|
||||||
|
|
@ -1363,7 +1377,7 @@ eol_2:
|
||||||
hit_eof (dtp);
|
hit_eof (dtp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else if (c != '\n')
|
||||||
eat_line (dtp);
|
eat_line (dtp);
|
||||||
sprintf (message, "Bad complex value in item %d of list input",
|
sprintf (message, "Bad complex value in item %d of list input",
|
||||||
dtp->u.p.item_count);
|
dtp->u.p.item_count);
|
||||||
|
|
@ -1726,8 +1740,9 @@ read_real (st_parameter_dt *dtp, void * dest, int length)
|
||||||
hit_eof (dtp);
|
hit_eof (dtp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else if (c != '\n')
|
||||||
eat_line (dtp);
|
eat_line (dtp);
|
||||||
|
|
||||||
sprintf (message, "Bad real number in item %d of list input",
|
sprintf (message, "Bad real number in item %d of list input",
|
||||||
dtp->u.p.item_count);
|
dtp->u.p.item_count);
|
||||||
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
|
generate_error (&dtp->common, LIBERROR_READ_VALUE, message);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue