All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Jim Mattson <jmattson@google.com>
Cc: Bill Wendling <morbo@google.com>, kvm list <kvm@vger.kernel.org>
Subject: Re: [kvm-unit-tests PATCH] x86: setjmp: ignore clang's "-Wsomtimes-uninitialized" flag
Date: Tue, 10 Sep 2019 10:59:25 -0700	[thread overview]
Message-ID: <20190910175924.GA11151@linux.intel.com> (raw)
In-Reply-To: <CALMp9eSWpCWDSCgownxsMVTmJNjMvYMiH0K2ybD6yzGqJNiZrg@mail.gmail.com>

On Tue, Sep 10, 2019 at 09:46:36AM -0700, Jim Mattson wrote:
> On Mon, Sep 9, 2019 at 2:10 PM Bill Wendling <morbo@google.com> wrote:
> >
> > Clang complains that "i" might be uninitialized in the "printf"
> > statement. This is a false negative, because it's set in the "if"
> > statement and then incremented in the loop created by the "longjmp".
> >
> > Signed-off-by: Bill Wendling <morbo@google.com>
> > ---
> >  x86/setjmp.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/x86/setjmp.c b/x86/setjmp.c
> > index 976a632..cf9adcb 100644
> > --- a/x86/setjmp.c
> > +++ b/x86/setjmp.c
> > @@ -1,6 +1,10 @@
> >  #include "libcflat.h"
> >  #include "setjmp.h"
> >
> > +#ifdef __clang__
> > +#pragma clang diagnostic ignored "-Wsometimes-uninitialized"
> > +#endif
> > +
> >  int main(void)
> >  {
> >      volatile int i;
> 
> Can we just add an initializer here instead?

Doing so would also be a good opportunity to actually report on the
expected vs. actual value of 'i' instead of printing numbers that are
meaningless without diving into the code.

  reply	other threads:[~2019-09-10 17:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-09 21:09 [kvm-unit-tests PATCH] x86: setjmp: ignore clang's "-Wsomtimes-uninitialized" flag Bill Wendling
2019-09-10 16:46 ` Jim Mattson
2019-09-10 17:59   ` Sean Christopherson [this message]
2019-09-11  1:42     ` Bill Wendling
2019-09-11  2:32       ` Bill Wendling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190910175924.GA11151@linux.intel.com \
    --to=sean.j.christopherson@intel.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=morbo@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.