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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-07-11
                 CC|                            |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  I think a feature along these lines could be useful as a
generalization of some existing warnings (such as -Walloc-zero,
-Walloc-size-larger-than, or -Wnonnull) and future ones like those.

An aspect of the attribute that might be worth handling differently in GCC than
in Clang is whether the checking should be restricted to just arguments that
are constant expressions or also applied to arguments that are the result of
constant or value range propagation (or perhaps even other forms of
optimization.  I think the latter would make it more powerful in GCC, but I
wonder if there might also be cases where it could lead to excessive false
positives.  If there were such cases, generalizing the attribute to specify
what kinds of expressions the diagnostic should consider might be worthwhile
(i.e., constant expressions only, or even those where the expression is known
to have a value or be in some range as a result of various optimizations).

Reply via email to