http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59836
Dominique d'Humieres <dominiq at lps dot ens.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jb at gcc dot gnu.org --- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- The line if (w > 0 && d == 0 && p == 0) has been introduced at r173408 and obviously the first code in comment 0 has started to give the wrong output after it. The second code in comment 0 has started to give the wrong output after r185433 (so far I did not try to understand why). Note that the block if (nbefore + nafter == 0) { ndigits = 0; if (nzero_real == d && digits[0] >= rchar) { /* We rounded to zero but shouldn't have */ nzero--; nafter = 1; digits[0] = '1'; ndigits = 1; } is present in the first version of libgfortran/io/write_float.def (r128114) with char replaced with '5' (the change was introduced at r152263).