From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9741FC49ED7 for ; Tue, 10 Sep 2019 17:59:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BD5B21479 for ; Tue, 10 Sep 2019 17:59:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726696AbfIJR70 (ORCPT ); Tue, 10 Sep 2019 13:59:26 -0400 Received: from mga17.intel.com ([192.55.52.151]:2258 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726524AbfIJR7Z (ORCPT ); Tue, 10 Sep 2019 13:59:25 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Sep 2019 10:59:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,490,1559545200"; d="scan'208";a="191886592" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.41]) by FMSMGA003.fm.intel.com with ESMTP; 10 Sep 2019 10:59:25 -0700 Date: Tue, 10 Sep 2019 10:59:25 -0700 From: Sean Christopherson To: Jim Mattson Cc: Bill Wendling , kvm list Subject: Re: [kvm-unit-tests PATCH] x86: setjmp: ignore clang's "-Wsomtimes-uninitialized" flag Message-ID: <20190910175924.GA11151@linux.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tue, Sep 10, 2019 at 09:46:36AM -0700, Jim Mattson wrote: > On Mon, Sep 9, 2019 at 2:10 PM Bill Wendling 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 > > --- > > 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.