re PR fortran/32446 (F0.n output format fails with large numbers)

2007-06-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/32446
	* io/write.c (output_float): Calculate ndigits correctly for large
	numbered formats that must pad zeros before the decimal point.

From-SVN: r125985
This commit is contained in:
Jerry DeLisle 2007-06-24 18:54:50 +00:00
parent 2eae3dc776
commit 69774e69a7
2 changed files with 18 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2007-06-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/32446
* io/write.c (output_float): Calculate ndigits correctly for large
numbered formats that must pad zeros before the decimal point.
2007-06-15 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
PR libfortran/32345

View File

@ -810,16 +810,21 @@ output_float (st_parameter_dt *dtp, const fnode *f, GFC_REAL_LARGEST value)
if (nbefore > 0)
{
if (nbefore > ndigits)
i = ndigits;
{
i = ndigits;
memcpy (out, digits, i);
ndigits = 0;
while (i < nbefore)
out[i++] = '0';
}
else
i = nbefore;
memcpy (out, digits, i);
while (i < nbefore)
out[i++] = '0';
{
i = nbefore;
memcpy (out, digits, i);
ndigits -= i;
}
digits += i;
ndigits -= i;
out += nbefore;
}
/* Output the decimal point. */