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

David Blaikie dblaikie at gmail.com
Tue Feb 17 23:17:59 PST 2015


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150217/9dc48b89/attachment.html>


More information about the llvm-commits mailing list