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

Matthias Kretz (Vir) <kretz at kde dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kretz at kde dot org

--- Comment #21 from Matthias Kretz (Vir) <kretz at kde dot org> ---
Is it possible to insert a predicated warning-marker into the tree in the front
end? Basically "if signed object can be negative, emit OPT_Wsign_compare
warning". It could even strengthen the message if it detects that the signed
object is guaranteed to be negative.

Then the middle end can either drop the warning from the tree or emit it as
suggested by the front end.

Test case, showing that simply predicating the warning with `if (x < 0)` works:
https://godbolt.org/z/iFePwJ. However, -O2 would still show the warning.

Reply via email to