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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #1)
> The docs explain why GCC's -Wmemset-transposed-args doesn't warn:
> 
>   Warn for suspicious calls to the "memset" built-in function where the
> second
>   argument is not zero and the third argument is zero.  For example, the call
>   "memset (buf, sizeof buf, 0)" is diagnosed because "memset (buf, 0, sizeof
>   buf)" was meant instead.  The diagnostic is only emitted if the third
> argument
>   is a literal zero.
> 
> So not warning for your case is by design.
> 
> But it probably makes sense to warn if the second argument is a sizeof
> expression, whatever the value of the third argument.

What if both the second and third arguments are 'sizeof' expressions?

Reply via email to