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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is a correct warning. sum is only set and not used otherwise.

>Allegedly clang doesn't emit the warning.

That is because it treats `sum += i;` as an use but if you did `sum ++;` it
would not have been treated an use. GCC  is more consistent here with that
respect.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44677#c25 for the commit
message which documents this (and will be added to the porting to guide too).

Reply via email to