diff mbox

[libgfortran] PR47567 Wrong output for small absolute values with F editing

Message ID 4D5F1FE0.5000409@frontier.com
State New
Headers show

Commit Message

Jerry DeLisle Feb. 19, 2011, 1:41 a.m. UTC
This small patch adjusts the processor generated width for F0.d formatting to 
accommodate negative signs on zero.

Regression tested on x86-64. Updated test case provided.

OK for trunk?

Regards,

Jerry

2011-02-18  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libgfortran/47567
	* io/write_float.def (output_float): Adjust width for F0.d to
	allow space for negative signs on zero.

Comments

Jerry DeLisle Feb. 19, 2011, 3:14 p.m. UTC | #1
On 02/18/2011 05:41 PM, Jerry DeLisle wrote:
> This small patch adjusts the processor generated width for F0.d formatting to
> accommodate negative signs on zero.
>
> Regression tested on x86-64. Updated test case provided.
>
> OK for trunk?
>
> Regards,
>
> Jerry
>
> 2011-02-18 Jerry DeLisle <jvdelisle@gcc.gnu.org>
>
> PR libgfortran/47567
> * io/write_float.def (output_float): Adjust width for F0.d to
> allow space for negative signs on zero.

Committed after approval from Tobias on IRC.

Author: jvdelisle
Date: Sat Feb 19 15:10:55 2011
New Revision: 170318

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170318
Log:
2011-02-19  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

     PR libgfortran/47567
     * io/write_float.def (output_float): Adjust width for F0.d to
     allow space for negative signs on zero.
diff mbox

Patch

Index: write_float.def
===================================================================
--- write_float.def	(revision 170273)
+++ write_float.def	(working copy)
@@ -116,7 +116,7 @@  output_float (st_parameter_dt *dtp, const fnode *f
 
       /* Handle special cases.  */
       if (w == 0)
-	w = d + 1;
+	w = d + (sign != S_NONE ? 2 : 1) + (d == 0 ? 1 : 0);
 
       /* For this one we choose to not output a decimal point.
 	 F95 10.5.1.2.1  */