[compiler-rt] r229392 - tsan: fix compiler warning

Dmitry Vyukov dvyukov at google.com
Tue Feb 17 23:20:37 PST 2015


On Wed, Feb 18, 2015 at 10:17 AM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
> On Tue, Feb 17, 2015 at 11:16 PM, Dmitry Vyukov <dvyukov at google.com> wrote:
>>
>> On Tue, Feb 17, 2015 at 9:57 PM, David Blaikie <dblaikie at gmail.com> wrote:
>> >
>> >
>> > On Mon, Feb 16, 2015 at 5:53 AM, Dmitry Vyukov <dvyukov at google.com>
>> > wrote:
>> >>
>> >> Author: dvyukov
>> >> Date: Mon Feb 16 07:53:00 2015
>> >> New Revision: 229392
>> >>
>> >> URL: http://llvm.org/viewvc/llvm-project?rev=229392&view=rev
>> >> Log:
>> >> tsan: fix compiler warning
>> >>
>> >> mingw gcc complains:
>> >> warning: 'err' may be used uninitialized in this function
>> >> [-Wmaybe-uninitialized]
>> >>        Printf("Failed to read options from '%s': error %d\n", value,
>> >> err);
>> >
>> >
>> > Was the warning correct? Or could we be sure that ReadFileToBuffer would
>> > initialize 'err'?
>> >
>> > Generally we should try not to unnecessarily initialize variables just
>> > to
>> > satisfy warnings because it hurts sanitizers (though I suppose that
>> > argument
>> > doesn't apply to the sanitizer libraries themselves - it still seems
>> > like a
>> > good principle to apply)
>>
>> I guess it is as incorrect as most of C++ compiler warnings.
>>
>> This happened on windows, where you usually don't have a great choice
>> of host compilers. So I am not sure how else we can resolve it.
>
>
> We simply disable the warnings, don't have to switch host compilers - we
> have a bunch of MSVC warnings disabled in our build configs already, I
> believe.


MSVC has own set of weird warnings. But do you disable such
fundamental warnings as "potentially unint var"?



More information about the llvm-commits mailing list