All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: kernel test robot <lkp@intel.com>, Arnd Bergmann <arnd@arndb.de>,
	kbuild-all@lists.01.org,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: drivers/pinctrl/intel/pinctrl-intel.c:1663:14: warning: variable 'dummy' set but not used
Date: Fri, 30 Apr 2021 15:54:14 -0700	[thread overview]
Message-ID: <CAKwvOdk9wiGaSPMg6Ltj=aU4LvM0fnkgjWLNnTeLtpMJ1RYrMQ@mail.gmail.com> (raw)
In-Reply-To: <YIkhNjYTBgFpgcia@smile.fi.intel.com>

On Wed, Apr 28, 2021 at 1:47 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Wed, Apr 28, 2021 at 11:43:33AM +0300, Andy Shevchenko wrote:
> > +Cc: Arnd and Nick
> >
> > (Seems like a clang bug)
> >
> > On Wed, Apr 28, 2021 at 08:10:34AM +0800, kernel test robot wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > head:   e359bce39d9085ab24eaa0bb0778bb5f6894144a
> > > commit: 10c857f063fc63902160755a6e23fa594290c6d3 pinctrl: cherryview: Switch to use intel_pinctrl_get_soc_data()
> > > date:   8 months ago
> > > config: x86_64-randconfig-a005-20210426 (attached as .config)
> > > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 87fc97169e7901dfe56ca0da0d92da0c02d2ef48)
> > > reproduce (this is a W=1 build):
> > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > >         chmod +x ~/bin/make.cross
> > >         # install x86_64 cross compiling tool for clang build
> > >         # apt-get install binutils-x86-64-linux-gnu
> > >         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=10c857f063fc63902160755a6e23fa594290c6d3
> > >         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > >         git fetch --no-tags linus master
> > >         git checkout 10c857f063fc63902160755a6e23fa594290c6d3
> > >         # save the attached .config to linux build tree
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
> > >
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot <lkp@intel.com>
> > >
> > > All warnings (new ones prefixed by >>):
> > >
> > > >> drivers/pinctrl/intel/pinctrl-intel.c:1663:14: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
> > >            const char *dummy;
> > >                        ^
> > >    1 warning generated.
> >
> > Seems to me a bug in clang. The variable is used to check if the body of the
> > loop should be executed or not.
>
> The only way of make this variable being unused is to avoid the loop being
> executed at all. This may be the case iff (mind to f:s) the supplied size
> parameter is 0, but how on earth clang can prove it (esp. taking into
> consideration that it's not true in real life)?!

Yep, the patch that enabled support for this warning in clang was
reported after multiple reports from projects; I'm working on helping
the author revise it based on cases it still flags from the kernel.
-- 
Thanks,
~Nick Desaulniers

WARNING: multiple messages have this Message-ID (diff)
From: Nick Desaulniers <ndesaulniers@google.com>
To: kbuild-all@lists.01.org
Subject: Re: drivers/pinctrl/intel/pinctrl-intel.c:1663:14: warning: variable 'dummy' set but not used
Date: Fri, 30 Apr 2021 15:54:14 -0700	[thread overview]
Message-ID: <CAKwvOdk9wiGaSPMg6Ltj=aU4LvM0fnkgjWLNnTeLtpMJ1RYrMQ@mail.gmail.com> (raw)
In-Reply-To: <YIkhNjYTBgFpgcia@smile.fi.intel.com>

[-- Attachment #1: Type: text/plain, Size: 2677 bytes --]

On Wed, Apr 28, 2021 at 1:47 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Wed, Apr 28, 2021 at 11:43:33AM +0300, Andy Shevchenko wrote:
> > +Cc: Arnd and Nick
> >
> > (Seems like a clang bug)
> >
> > On Wed, Apr 28, 2021 at 08:10:34AM +0800, kernel test robot wrote:
> > > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > > head:   e359bce39d9085ab24eaa0bb0778bb5f6894144a
> > > commit: 10c857f063fc63902160755a6e23fa594290c6d3 pinctrl: cherryview: Switch to use intel_pinctrl_get_soc_data()
> > > date:   8 months ago
> > > config: x86_64-randconfig-a005-20210426 (attached as .config)
> > > compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 87fc97169e7901dfe56ca0da0d92da0c02d2ef48)
> > > reproduce (this is a W=1 build):
> > >         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> > >         chmod +x ~/bin/make.cross
> > >         # install x86_64 cross compiling tool for clang build
> > >         # apt-get install binutils-x86-64-linux-gnu
> > >         # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=10c857f063fc63902160755a6e23fa594290c6d3
> > >         git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> > >         git fetch --no-tags linus master
> > >         git checkout 10c857f063fc63902160755a6e23fa594290c6d3
> > >         # save the attached .config to linux build tree
> > >         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64
> > >
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot <lkp@intel.com>
> > >
> > > All warnings (new ones prefixed by >>):
> > >
> > > >> drivers/pinctrl/intel/pinctrl-intel.c:1663:14: warning: variable 'dummy' set but not used [-Wunused-but-set-variable]
> > >            const char *dummy;
> > >                        ^
> > >    1 warning generated.
> >
> > Seems to me a bug in clang. The variable is used to check if the body of the
> > loop should be executed or not.
>
> The only way of make this variable being unused is to avoid the loop being
> executed at all. This may be the case iff (mind to f:s) the supplied size
> parameter is 0, but how on earth clang can prove it (esp. taking into
> consideration that it's not true in real life)?!

Yep, the patch that enabled support for this warning in clang was
reported after multiple reports from projects; I'm working on helping
the author revise it based on cases it still flags from the kernel.
-- 
Thanks,
~Nick Desaulniers

  reply	other threads:[~2021-04-30 22:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-28  0:10 drivers/pinctrl/intel/pinctrl-intel.c:1663:14: warning: variable 'dummy' set but not used kernel test robot
2021-04-28  0:10 ` kernel test robot
2021-04-28  8:43 ` Andy Shevchenko
2021-04-28  8:43   ` Andy Shevchenko
2021-04-28  8:47   ` Andy Shevchenko
2021-04-28  8:47     ` Andy Shevchenko
2021-04-30 22:54     ` Nick Desaulniers [this message]
2021-04-30 22:54       ` Nick Desaulniers

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='CAKwvOdk9wiGaSPMg6Ltj=aU4LvM0fnkgjWLNnTeLtpMJ1RYrMQ@mail.gmail.com' \
    --to=ndesaulniers@google.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.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.