https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70235

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Jerry DeLisle from comment #4)
> I will get started on this one. Dominique, if you spot the problem let me
> know.

In determine_precision, one has:

  int precision = f->u.real.d;  // "3" as "F8.3" is used
    case FMT_F:
      precision += dtp->u.p.scale_factor;  // 3 += -6 -> -3
      precision += 2 * len + 4; // -3 += 2 * 8 + 4 -> 17  ("8" from "F8.3")

i.e. one increased the precision for later manual rounding.

And later in "output_float"

          else /* p < 0  */
              if (nbefore + p >= 0)  // False as  5 + (-6) < -1
              else
                  nafter = d + nbefore;

which sets nafter to 3 + 5 = 8. One then later has:

   nblanks = w - (nbefore + nzero + nafter + edigits + 1);
   // -2 = 8 - (0+1+8+0+1)

as nblanks < 0, one get the "********".


My gut feeling is that it has something to do with having "precision" == 17 in
that function. In any case, the nafter is too large when nblanks is calculated.

Reply via email to