write_float.def (output_float): Move block determining room for leading zero to before checkng g0 formatting.

2015-11-22  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* io/write_float.def (output_float): Move block determining
	room for leading zero to before checkng g0 formatting.

From-SVN: r230728
This commit is contained in:
Jerry DeLisle 2015-11-22 22:14:46 +00:00
parent 4f8a3b87f9
commit ba67259c00
2 changed files with 15 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2015-11-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* io/write_float.def (output_float): Move block determining
room for leading zero to before checkng g0 formatting.
2015-09-12 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR libfortran/67527

View File

@ -514,12 +514,21 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
w = w == 1 ? 2 : w;
}
}
/* Work out how much padding is needed. */
nblanks = w - (nbefore + nzero + nafter + edigits + 1);
if (sign != S_NONE)
nblanks--;
/* See if we have space for a zero before the decimal point. */
if (nbefore == 0 && nblanks > 0)
{
leadzero = 1;
nblanks--;
}
else
leadzero = 0;
if (dtp->u.p.g0_no_blanks)
{
w -= nblanks;
@ -544,15 +553,6 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size,
return false;
}
/* See if we have space for a zero before the decimal point. */
if (nbefore == 0 && nblanks > 0)
{
leadzero = 1;
nblanks--;
}
else
leadzero = 0;
/* For internal character(kind=4) units, we duplicate the code used for
regular output slightly modified. This needs to be maintained
consistent with the regular code that follows this block. */