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

Dmitry Vyukov dvyukov at google.com
Tue Feb 17 23:16:08 PST 2015

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.

More information about the llvm-commits mailing list