[Bug fortran/60128] [4.8/4.9 Regression] Wrong ouput using en edit descriptor

dominiq at lps dot ens.fr gcc-bugzilla@gcc.gnu.org
Mon Feb 10 09:52:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60128

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jb at gcc dot gnu.org,
                   |                            |jvdelisle at gcc dot gnu.org

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
This likely due to r185433. This fixed by the following patch

--- ../_clean/libgfortran/io/write_float.def    2014-01-21 08:30:57.000000000
+0100
+++ libgfortran/io/write_float.def    2014-02-10 10:23:13.000000000 +0100
@@ -1215,8 +1211,8 @@ determine_en_precision (st_parameter_dt 
     nbefore = 3 - nbefore;
     }
   int prec = f->u.real.d + nbefore;
-  if (dtp->u.p.current_unit->round_status != ROUND_UNSPECIFIED
-      && dtp->u.p.current_unit->round_status != ROUND_PROCDEFINED)
+  /* if (dtp->u.p.current_unit->round_status != ROUND_UNSPECIFIED
+      && dtp->u.p.current_unit->round_status != ROUND_PROCDEFINED) */
     prec += 2 * len + 4;
   return prec;
 }

For the following extended test

write(*,"(en15.2)") -.44444
write(*,"(rp,en15.2)") -.44444
write(*,"(rc,en15.2)") -.44444
write(*,"(rz,en15.2)") -.44444
write(*,"(rd,en15.2)") -.44444
write(*,"(en15.2)") -.44446
write(*,"(en15.1)") -.44444
end

before the patch, the output is

    -444.40E-03
    -444.40E-03
    -444.44E-03
    -444.44E-03
    -444.45E-03
    -444.50E-03
     -444.0E-03

after the patch, it is

    -444.44E-03
    -444.44E-03
    -444.44E-03
    -444.44E-03
    -444.45E-03
    -444.46E-03
     -444.4E-03

Regtesting in progress. Note that the block

-  if (dtp->u.p.current_unit->round_status != ROUND_UNSPECIFIED
-      && dtp->u.p.current_unit->round_status != ROUND_PROCDEFINED)

appears in several places in libgfortran/io/write_float.def and I fail to see
the logic.



More information about the Gcc-bugs mailing list