On Mon, Sep 13, 2021 at 9:53 AM Jason Gunthorpe <jgg(a)nvidia.com> wrote:
On Sat, Sep 11, 2021 at 08:17:08PM +0800, kernel test robot wrote:
> tree:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 926de8c4326c14fcf35f1de142019043597a4fac
> commit: 84f969e1c48ed3825986e91a0786e363d57f69d1 IB/qib: Fix null pointer
subtraction compiler warning
> date: 3 days ago
> config: x86_64-randconfig-a014-20210911 (attached as .config)
> compiler: clang version 14.0.0 (
https://github.com/llvm/llvm-project
261cbe98c38f8c1ee1a482fe76511110e790f58a)
> 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
> #
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit...
> git remote add linus
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch --no-tags linus master
> git checkout 84f969e1c48ed3825986e91a0786e363d57f69d1
> # save the attached .config to linux build tree
> mkdir build_dir
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir
ARCH=x86_64 SHELL=/bin/bash
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp(a)intel.com>
>
> All errors (new ones prefixed by >>):
>
> >> drivers/infiniband/hw/qib/qib_sysfs.c:413:1: error: static_assert
expression is not an integral constant expression
> QIB_DIAGC_ATTR(rc_resends);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/qib/qib_sysfs.c:406:16: note: expanded from macro
'QIB_DIAGC_ATTR'
> static_assert(&((struct qib_ibport *)0)->rvp.n_##N != (u64
*)NULL); \
> ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/build_bug.h:77:50: note: expanded from macro
'static_assert'
> #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> include/linux/build_bug.h:78:56: note: expanded from macro
'__static_assert'
> #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> ^~~~
> drivers/infiniband/hw/qib/qib_sysfs.c:413:1: note: cannot access field of null
pointer
> drivers/infiniband/hw/qib/qib_sysfs.c:406:43: note: expanded from macro
'QIB_DIAGC_ATTR'
> static_assert(&((struct qib_ibport *)0)->rvp.n_##N != (u64
*)NULL); \
> ^
> drivers/infiniband/hw/qib/qib_sysfs.c:414:1: error: static_assert expression is
not an integral constant expression
> QIB_DIAGC_ATTR(seq_naks);
> ^~~~~~~~~~~~~~~~~~~~~~~~
Nick/Nathan
Clang is being a real PITA here - do you know of a solution?
Hi Jason,
Thanks for wrestling with this. We filed a quick thread last week to
track this:
https://github.com/ClangBuiltLinux/linux/issues/1452
With conferences this and next week, and -Werror fallout, there's a
lot of fire right now and not a lot of time to triage.
I guess I'm curious, what is the intent of what this code is trying to
do, and can this be replaced with BUILD_BUG_ON?
This macro would like to know that the passed in member name has a u64
type, all the things I've come up with fail on clang - but many work
fine on gcc. Frankly I think this case is a clang bug myself..
Perhaps, though this assertion looks a bit like offsetof() to me. I
wonder if that can help here?
--
Thanks,
~Nick Desaulniers