[PATCH] Declare __warn_memset_zero_len internally for newer gcc [bz #25399]
Florian Weimer
fweimer@redhat.com
Tue Nov 3 16:05:54 GMT 2020
* Serge Guelton:
> On Tue, Nov 03, 2020 at 04:05:11PM +0100, Florian Weimer wrote:
>> * Siddhesh Poyarekar via Libc-alpha:
>>
>> > The __warn_memset_zero_len symbol, used to issue a linker warning
>> > about zero length memset calls, is included in warning-nop.o only when
>> > glibc is built with an older gcc, which is incorrect. When a program
>> > calling memset with zero length is built with either gcc < 5.0 or with
>> > clang (which advertises __GNUC__ as 4), it results in a link failure
>> > due to not finding the symbol in libc_nonshared.a.
>> >
>> > Fill in this gap by declaring __warn_memset_zero_len for newer gcc as
>> > well so that it is always available in libc_nonshared.a for any
>> > compiler to link against.
>>
>> Does Clang have its own warning for this?
>
> Clang has -Wmemset-transposed-args. The warning is emitted during smeantic
> analysis, catching two patterns: 1. a size argument of 0 and 2. when the
> constant argument is a sizeof
Is it enabled by -Wall?
Thanks,
Florian
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
More information about the Libc-alpha
mailing list