re PR fortran/35036 (illegal E format descriptor produces wrong output)

2008-02-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/35036
	* write_float.def (output_float):  Add error checks for zero digits
	after decimal point in E and D format specifiers.

From-SVN: r132510
This commit is contained in:
Jerry DeLisle 2008-02-21 02:20:27 +00:00
parent eac9ed5e34
commit 50a932e0cb
2 changed files with 19 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2008-02-20 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/35036
* write_float.def (output_float): Add error checks for zero digits
after decimal point in E and D format specifiers.
2008-02-10 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/35063

View File

@ -167,6 +167,19 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
case FMT_E:
case FMT_D:
i = dtp->u.p.scale_factor;
if (d <= 0 && i == 0)
{
generate_error (&dtp->common, LIBERROR_FORMAT, "Precision not "
"greater than zero in format specifier 'E' or 'D'");
return;
}
if (i <= -d || i >= d + 2)
{
generate_error (&dtp->common, LIBERROR_FORMAT, "Scale factor "
"out of range in format specifier 'E' or 'D'");
return;
}
if (!zero_flag)
e -= i;
if (i < 0)