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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |missed-optimization
   Last reconfirmed|                            |2025-08-26
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So I think the problem is GCC can't figure out that send is only `sbeg+[1,3]`.

If I change the code to be:

```
  size_t t = 0;

  do {
    *send++ = '0';
    t++;
    --width;
  } while ((val /= 10) && width > 0);

  send = sbeg + t;
  ret += send - sbeg;
```

The warning goes away.

Reply via email to