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

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
On Wed, 2 Aug 2017, msebor at gcc dot gnu.org wrote:

> 1) When attribute unused is specified on a function argument of pointer type 
> in
> a declaration of a function, GCC could use that as an indication that the
> argument is, in fact, not used by the implementation of the function and 
> assume
> that the object the pointer points to is unchanged by the function call.

It's peculiar to use the attribute on an argument in a declaration that's 
not a definition, but in definitions it very definitely means *may be 
unused* - for example, the attribute may be present unconditionally for a 
function where the argument might or might not be used, depending on 
various preprocessor conditionals, to avoid needing to replicate those 
conditionals when declaring the argument.  So this would not be a valid 
optimization.

Reply via email to