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

David Blaikie dblaikie at gmail.com
Wed Feb 18 09:05:58 PST 2015


On Wed, Feb 18, 2015 at 1:40 AM, Dmitry Vyukov <dvyukov at google.com> wrote:

> Added -Wno-maybe-uninitialized to mingw gcc flags and reverted the =0:
>

Awesome - thanks!


> http://llvm.org/viewvc/llvm-project?view=revision&revision=229657
>
>
> On Wed, Feb 18, 2015 at 10:29 AM, David Blaikie <dblaikie at gmail.com>
> wrote:
> > well the one you quoted in the commit message is actually a GCC (mingw)
> one,
> > which I think we've tried to disable (should be disabled with
> > -Wno-maybe-uninitialized). Clang has a better version
> > -Wsometimes-uninitialized anyway.
> >
> > As for disabling MSVC warnings... I'm sure we have a few disabled *tries
> to
> > find them* Nope, don't recall where they are.
> >
> > On Tue, Feb 17, 2015 at 11:20 PM, Dmitry Vyukov <dvyukov at google.com>
> wrote:
> >>
> >> 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"?
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150218/a23b5701/attachment.html>


More information about the llvm-commits mailing list