[compiler-rt] r211008 - [asan] initialze varaibles to avoid a (false positive) report from gcc's -Wmaybe-uninitialized

David Blaikie dblaikie at gmail.com
Mon Jun 16 08:18:58 PDT 2014


On Mon, Jun 16, 2014 at 8:14 AM, Kostya Serebryany <kcc at google.com> wrote:
>
>
>
> On Mon, Jun 16, 2014 at 6:56 PM, David Blaikie <dblaikie at gmail.com> wrote:
>>
>> Should we just disable gccs warning since clang has a better/more
>> principled version anyway?
>
> We may, but it will not help if someone is building sanitizers outside of
> llvm build system(s), e.g. as part of GCC.

Well, if they're not building it with clang, specifically. But what %
of the developers build without clang?

The approach we take for the rest of LLVM (which might not apply here,
as you suggest) is that we have enough people developing with clang
-Werror that clang warning violations don't last long in the codebase
because a human or bot catches them pretty quickly and fixes or
responds to code review. These transient false negatives usually seem
like the better tradeoff that will happen relatively infrequently (due
to the small number of people building with non-clang) compared to
trying to hold the project to a bar based on a compiler most people
don't use on the project (coupled with the disadvantage of obfuscating
code to appease false positives - in this case, initializing a
variable that doesn't need to be initialized will suppress things like
msan from catching actual bugs in this code should they arise)

[+Chandler who's expressed this sentiment (a desire to avoid silencing
false positive warnings when they limit the power of our tools to
catch real bugs) previously]

>
>
>>
>> On Jun 16, 2014 1:53 AM, "Kostya Serebryany" <kcc at google.com> wrote:
>>>
>>> Author: kcc
>>> Date: Mon Jun 16 03:32:02 2014
>>> New Revision: 211008
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=211008&view=rev
>>> Log:
>>> [asan] initialze varaibles to avoid a (false positive) report from gcc's
>>> -Wmaybe-uninitialized
>>>
>>> Modified:
>>>
>>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
>>>
>>> Modified:
>>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc?rev=211008&r1=211007&r2=211008&view=diff
>>>
>>> ==============================================================================
>>> ---
>>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc
>>> (original)
>>> +++
>>> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors.inc Mon
>>> Jun 16 03:32:02 2014
>>> @@ -1812,7 +1812,7 @@ INTERCEPTOR(int, getsockopt, int sockfd,
>>>  INTERCEPTOR(int, accept, int fd, void *addr, unsigned *addrlen) {
>>>    void *ctx;
>>>    COMMON_INTERCEPTOR_ENTER(ctx, accept, fd, addr, addrlen);
>>> -  unsigned addrlen0;
>>> +  unsigned addrlen0 = 0;
>>>    if (addrlen) {
>>>      COMMON_INTERCEPTOR_READ_RANGE(ctx, addrlen, sizeof(*addrlen));
>>>      addrlen0 = *addrlen;
>>> @@ -1834,7 +1834,7 @@ INTERCEPTOR(int, accept, int fd, void *a
>>>  INTERCEPTOR(int, accept4, int fd, void *addr, unsigned *addrlen, int f)
>>> {
>>>    void *ctx;
>>>    COMMON_INTERCEPTOR_ENTER(ctx, accept4, fd, addr, addrlen, f);
>>> -  unsigned addrlen0;
>>> +  unsigned addrlen0 = 0;
>>>    if (addrlen) {
>>>      COMMON_INTERCEPTOR_READ_RANGE(ctx, addrlen, sizeof(*addrlen));
>>>      addrlen0 = *addrlen;
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>



More information about the llvm-commits mailing list