diff options
author | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-05 17:58:48 +0000 |
---|---|---|
committer | jvdelisle <jvdelisle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-02-05 17:58:48 +0000 |
commit | b67cfb58038059619dc900f3a42e7b850e2d9b00 (patch) | |
tree | 0839008fa5b6efa422fa3e12b93f45f742706a9c /libgfortran | |
parent | f2c8d53a5fdde4f206589a0516e58927d88dd750 (diff) | |
download | gcc-b67cfb58038059619dc900f3a42e7b850e2d9b00.tar.gz |
2011-02-05 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/47567
* io/write_float.def (output_float): Eliminate some redundant code.
Adjust width for case of F0.X for values of zero and all other values.
Expand cases where '*' is set to give cleaner results.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169853 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 7 | ||||
-rw-r--r-- | libgfortran/io/write_float.def | 14 |
2 files changed, 14 insertions, 7 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index fbeb87da55c..82f933874d5 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,10 @@ +2011-02-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/47567 + * io/write_float.def (output_float): Eliminate some redundant code. + Adjust width for case of F0.X for values of zero and all other values. + Expand cases where '*' is set to give cleaner results. + 2011-02-05 Janne Blomqvist <jb@gcc.gnu.org> PR libfortran/47571 diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def index a77b3042768..21bbfbbf04e 100644 --- a/libgfortran/io/write_float.def +++ b/libgfortran/io/write_float.def @@ -111,14 +111,12 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, if (zero_flag) { e = 0; - if (compile_options.sign_zero == 1) - sign = calculate_sign (dtp, sign_bit); - else + if (compile_options.sign_zero != 1) sign = calculate_sign (dtp, 0); /* Handle special cases. */ if (w == 0) - w = d + 2; + w = d + 1; /* For this one we choose to not output a decimal point. F95 10.5.1.2.1 */ @@ -138,7 +136,6 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, *out = '0'; return SUCCESS; } - } /* Normalize the fractional component. */ @@ -417,7 +414,10 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, /* Pick a field size if none was specified. */ if (w <= 0) - w = nbefore + nzero + nafter + (sign != S_NONE ? 2 : 1); + { + w = nbefore + nzero + nafter + (sign != S_NONE ? 2 : 1); + w = w == 1 ? 2 : w; + } /* Work out how much padding is needed. */ nblanks = w - (nbefore + nzero + nafter + edigits + 1); @@ -436,7 +436,7 @@ output_float (st_parameter_dt *dtp, const fnode *f, char *buffer, size_t size, return FAILURE; /* Check the value fits in the specified field width. */ - if (nblanks < 0 || edigits == -1) + if (nblanks < 0 || edigits == -1 || w == 1 || (w == 2 && sign != S_NONE)) { if (unlikely (is_char4_unit (dtp))) { |