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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |manu at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
It would be great if someone tried to implement this someday, it doesn't seem
trivial though.

(In reply to Mikhail Maltsev from comment #1)
> Clang also gives false positive. EDG does not warn for such conversions
> (even unconditional).

As far as I can tell, if the warning is given in the FE by using some kind of
limited VRP (which is what Clang does), the number of false positives can only
decrease, since the worst that can happen is that the analysis is not powerful
enough. The main objection to this has been the extra compilation time that
this analysis may require just for a warning (with GCC being already too slow).

Implementing it in the middle-end seems to me worse, since, as you point out,
then you may increase the number of false positives and strange things may
happen once other optimizations transform the code (also, optimization may hide
valid warnings).

A third proposal that has been floated around is to somehow mark the statement
with the warning but not emit it until after optimization. If the warning
survives after the middle-end analysis, then it will be given. This approach
seems even more complex to me.

*** This bug has been marked as a duplicate of bug 38470 ***

Reply via email to