memset bugs.

Gregory Maxwell gmaxwell at gmail.com
Fri Nov 27 08:28:19 UTC 2009


On Fri, Nov 27, 2009 at 1:26 AM, Roopesh Majeti
<roopesh.majeti at gmail.com> wrote:
> Hi All,
> Iam new to this fedora world.. a small question on the below discussion:
> It is mentioned that having, zero in the third argument is legitimate use
> cases. Can somebody direct me to such a use case, as i feel, giving memset a
> zero, is asking it, not to do anything [ might have side effects, not sure
> from my end, though ].

It's legitimate because the zero may ultimately be derived from macro values
and restructuring the code to avoid the memset depending on defined values
may be non-trivial or even impossible.

John Reiser provided a good example:
http://www.linux-archive.org/fedora-development/286221-memset-bugs.html

Where its not a programming bug the memset(,,0) is harmless: GCC optimizes it
out completely.

A literal zero prior to preprocessing is either a bug, or some kind of dead-
code causing place-holder.




More information about the fedora-devel-list mailing list