[compiler-rt] r183645 - tsan: fix old gcc warnings

Dmitry Vyukov dvyukov at google.com
Mon Jun 10 04:15:00 PDT 2013


On Mon, Jun 10, 2013 at 3:14 PM, Dmitry Vyukov <dvyukov at google.com> wrote:
> It's gcc4.7 and it says:

gcc gotsan.cc -S -o tmp.s -I../rtl -I../.. -I../../sanitizer_common
-I../../../include -m64 -Wall -Werror -fno-exception
s -fno-rtti -DTSAN_GO -DSANITIZER_GO -DTSAN_SHADOW_COUNT=4
-Wno-error=attributes -Wno-attributes -DTSAN_DEBUG=0 -O3 -fom
it-frame-pointer
In file included from ../rtl/tsan_clock.h:17:0,
                 from ../rtl/tsan_rtl.h:33,
                 from gotsan.cc:14:
../rtl/tsan_vector.h: In function 'void
__tsan::ReportRace(__tsan::ThreadState*)':
../rtl/tsan_vector.h:63:5: error: '*((void*)(&
hash)+16).__tsan::MD5Hash::hash[1]' may be used uninitialized in this
fun
ction [-Werror=maybe-uninitialized]
gotsan.cc:2709:14: note: '*((void*)(&
hash)+16).__tsan::MD5Hash::hash[1]' was declared here
In file included from ../rtl/tsan_clock.h:17:0,
                 from ../rtl/tsan_rtl.h:33,
                 from gotsan.cc:14:
../rtl/tsan_vector.h:63:5: error: '*((void*)(&
hash)+16).__tsan::MD5Hash::hash[0]' may be used uninitialized in this
fun
ction [-Werror=maybe-uninitialized]
gotsan.cc:2709:14: note: '*((void*)(&
hash)+16).__tsan::MD5Hash::hash[0]' was declared here
In file included from ../rtl/tsan_clock.h:17:0,
                 from ../rtl/tsan_rtl.h:33,
                 from gotsan.cc:14:
../rtl/tsan_vector.h:63:5: error: 'hash.__tsan::MD5Hash::hash[1]' may
be used uninitialized in this function [-Werror=ma
ybe-uninitialized]
gotsan.cc:2709:14: note: 'hash.__tsan::MD5Hash::hash[1]' was declared here
In file included from ../rtl/tsan_clock.h:17:0,
                 from ../rtl/tsan_rtl.h:33,
                 from gotsan.cc:14:
../rtl/tsan_vector.h:63:5: error: 'hash.__tsan::MD5Hash::hash[0]' may
be used uninitialized in this function [-Werror=ma
ybe-uninitialized]
gotsan.cc:2709:14: note: 'hash.__tsan::MD5Hash::hash[0]' was declared here
cc1plus.exe: all warnings being treated as errors



> On Mon, Jun 10, 2013 at 2:38 PM, Alexey Samsonov <samsonov at google.com> wrote:
>> I think this change will lead to warnings in the newer compilers. AFAIR
>> we've dropped gcc 4.4 support in sanitizers. Is it needed for
>> Go-ThreadSanitizer?
>>
>>
>> On Mon, Jun 10, 2013 at 2:30 PM, Dmitry Vyukov <dvyukov at google.com> wrote:
>>>
>>> Author: dvyukov
>>> Date: Mon Jun 10 05:30:19 2013
>>> New Revision: 183645
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=183645&view=rev
>>> Log:
>>> tsan: fix old gcc warnings
>>>
>>> Modified:
>>>     compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
>>>
>>> Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc?rev=183645&r1=183644&r2=183645&view=diff
>>>
>>> ==============================================================================
>>> --- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc (original)
>>> +++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl_report.cc Mon Jun 10 05:30:19
>>> 2013
>>> @@ -448,7 +448,7 @@ static bool HandleRacyStacks(ThreadState
>>>      uptr addr_min, uptr addr_max) {
>>>    Context *ctx = CTX();
>>>    bool equal_stack = false;
>>> -  RacyStacks hash;
>>> +  RacyStacks hash = {};
>>>    if (flags()->suppress_equal_stacks) {
>>>      hash.hash[0] = md5_hash(traces[0].Begin(), traces[0].Size() *
>>> sizeof(uptr));
>>>      hash.hash[1] = md5_hash(traces[1].Begin(), traces[1].Size() *
>>> sizeof(uptr));
>>> @@ -488,7 +488,7 @@ static void AddRacyStacks(ThreadState *t
>>>      uptr addr_min, uptr addr_max) {
>>>    Context *ctx = CTX();
>>>    if (flags()->suppress_equal_stacks) {
>>> -    RacyStacks hash;
>>> +    RacyStacks hash = {};
>>>      hash.hash[0] = md5_hash(traces[0].Begin(), traces[0].Size() *
>>> sizeof(uptr));
>>>      hash.hash[1] = md5_hash(traces[1].Begin(), traces[1].Size() *
>>> sizeof(uptr));
>>>      ctx->racy_stacks.PushBack(hash);
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
>>
>>
>> --
>> Alexey Samsonov, MSK



More information about the llvm-commits mailing list