[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230730170546.GA1666163@dev-arch.thelio-3990X>
Date: Sun, 30 Jul 2023 10:05:46 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: David Laight <David.Laight@...lab.com>
Cc: 'kernel test robot' <lkp@...el.com>,
"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>,
'Andy Shevchenko' <andriy.shevchenko@...ux.intel.com>,
'Andrew Morton' <akpm@...ux-foundation.org>,
"'Matthew Wilcox (Oracle)'" <willy@...radead.org>,
'Christoph Hellwig' <hch@...radead.org>,
"'Jason A. Donenfeld'" <Jason@...c4.com>,
"llvm@...ts.linux.dev" <llvm@...ts.linux.dev>,
"oe-kbuild-all@...ts.linux.dev" <oe-kbuild-all@...ts.linux.dev>
Subject: Re: [PATCH next v2 2/5] minmax: Allow min()/max()/clamp() if the
arguments have the same signedness.
On Sun, Jul 30, 2023 at 02:55:50PM +0000, David Laight wrote:
> From: kernel test robot
> > Sent: 29 July 2023 03:01
> >
> > kernel test robot noticed the following build errors:
> >
> ...)
> > compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git
> > 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
> > reproduce: (https://download.01.org/0day-ci/archive/20230729/202307290943.ODVeyeK6-
> > lkp@...el.com/reproduce)
> >
> ...
> > >> mm/percpu.c:3102:10: error: static assertion expression is not an integral constant expression
> > base = min(ptr, base);
> > ^~~~~~~~~~~~~~
> ... ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > include/linux/minmax.h:23:2: note: expanded from macro '__types_ok'
> > (is_signed_type(typeof(x)) == is_signed_type(typeof(y)))
> > ^
> ...
> > mm/percpu.c:3102:10: note: cast that performs the conversions of a reinterpret_cast is not allowed
> > in a constant expression
>
> That is a C++ error that seems to have crept into C.
> The relevant definition is:
>
> #define is_signed_type(type) (((type)(-1)) < (type)1)
>
> This seems to have been fixed in clang 16.0.0.
Indeed, it looks like
https://github.com/llvm/llvm-project/commit/a181de452df311d7647329120d05f4eb9c158b6c
fixed this as a result of the discussion at
https://github.com/llvm/llvm-project/issues/57687, which certainly makes
sense.
Cheers,
Nathan
Powered by blists - more mailing lists