https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121487
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2025-08-09
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Keywords| |missed-optimization
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I noticed there is a missing optimization issue:
```
: n(n_)
{
ptr = buffer;
for (int i = 0; i < 4; ++i) {
ptr[i] = static_cast<char>((a & 15) + '0');
a >>= 4;
}
// n = n_;
```
The store via ptr is causing issues. If I change it to be buffer instead of
ptr, the warning is gone. Or if I add a store to n after the loop, the warning
is gone (though not optimized the code is not optimized all the way away).