[PATCH] D17983: Eliminate many benign instances of "potentially uninitialized local variable" warnings

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 9 08:35:55 PST 2016


On Wed, Mar 9, 2016 at 8:23 AM, David Blaikie <dblaikie at gmail.com> wrote:

>
> On Mar 9, 2016 8:18 AM, "Teresa Johnson" <tejohnson at google.com> wrote:
> >
> >
> >
> > On Wed, Mar 9, 2016 at 8:13 AM, David Blaikie <dblaikie at gmail.com>
> wrote:
> >>
> >>
> >> On Mar 9, 2016 8:11 AM, "Teresa Johnson via llvm-commits" <
> llvm-commits at lists.llvm.org> wrote:
> >> >
> >> > tejohnson added a subscriber: tejohnson.
> >> > tejohnson added a comment.
> >> >
> >> > Thanks for doing this!
> >> >
> >> > I will fix these 3, which one of my changes would have provoked. It
> is a benign case since we do have an assert at the use site checking the
> same condition that the inits are guarded with, but there is no reason not
> to 0 init these to avoid the bogus warning.
> >>
> >> The reason not to is that it would silence msan catching the
> unintentional codepath (eg: if you didn't have the assert there, and they
> init and use conditions didn't match, msan would tell us - if we add what
> we believe to be a dead init, then msan no longer helps us here)
> >
> >
> > Hmm, ok. It's unfortunate that the warning and msan are at odds,
> although I don't know how to reconcile them.
>
> The approach we've taken so far, so far as I'm aware, is to disable
> warnings like this that have such false positives.
>
> > Will leave as is then. Is it worth a comment indicating why we are
> leaving them uninitialized?
>
> Not sure. If you think it helps readability. If it's fairly clear the
> variable is only used under the same condition that it's initialized, I
> think you could leave it.
>

Ok, sounds good.


> >>
> >> >
> >> > Warning C4701   potentially uninitialized local variable
> 'FnEntry8BitAbbrev' used       LLVMBitWriter
>  c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp       2353
> >> > Warning C4701   potentially uninitialized local variable
> 'FnEntry7BitAbbrev' used       LLVMBitWriter
>  c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp       2357
> >> > Warning C4701   potentially uninitialized local variable
> 'FnEntry6BitAbbrev' used       LLVMBitWriter
>  c:\llvm\llvm\lib\bitcode\writer\bitcodewriter.cpp       2355
> >> >
> >> >
> >> > http://reviews.llvm.org/D17983
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > llvm-commits mailing list
> >> > llvm-commits at lists.llvm.org
> >> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >
> >
> >
> >
> > --
> > Teresa Johnson |
> >  Software Engineer |
> >  tejohnson at google.com |
> >  408-460-2413
>



-- 
Teresa Johnson |  Software Engineer |  tejohnson at google.com |  408-460-2413
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160309/8fb86935/attachment.html>


More information about the llvm-commits mailing list