[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=Mf8CmKs-_FddnLFU7aoOAPU6Xv8MqyZo8x9Uv-Eu+hs_g@mail.gmail.com>
Date: Wed, 11 Dec 2024 13:46:11 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: David Laight <David.Laight@...lab.com>
Cc: Naresh Kamboju <naresh.kamboju@...aro.org>, Dan Carpenter <dan.carpenter@...aro.org>,
open list <linux-kernel@...r.kernel.org>,
"lkft-triage@...ts.linaro.org" <lkft-triage@...ts.linaro.org>,
Linux Regressions <regressions@...ts.linux.dev>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
"netfilter-devel@...r.kernel.org" <netfilter-devel@...r.kernel.org>, Arnd Bergmann <arnd@...db.de>,
Anders Roxell <anders.roxell@...aro.org>, Johannes Berg <johannes.berg@...el.com>,
"toke@...nel.org" <toke@...nel.org>, Al Viro <viro@...iv.linux.org.uk>,
"kernel@...rr.cc" <kernel@...rr.cc>, "kees@...nel.org" <kees@...nel.org>
Subject: Re: arm64: include/linux/compiler_types.h:542:38: error: call to
'__compiletime_assert_1050' declared with attribute error: clamp() low limit
min greater than high limit max_avail
On Fri, Dec 6, 2024 at 3:20 AM David Laight <David.Laight@...lab.com> wrote:
>
> From: Naresh Kamboju
> > Sent: 05 December 2024 18:42
> >
> > On Thu, 5 Dec 2024 at 20:46, Dan Carpenter <dan.carpenter@...aro.org> wrote:
> > >
> > > Add David to the CC list.
> >
> > Anders bisected this reported issue and found the first bad commit as,
> >
> > # first bad commit:
> > [ef32b92ac605ba1b7692827330b9c60259f0af49]
> > minmax.h: use BUILD_BUG_ON_MSG() for the lo < hi test in clamp()
>
> That 'just' changed the test to use __builtin_constant_p() and
> thus gets checked after the optimiser has run.
>
> I can paraphrase the code as:
> unsigned int fn(unsigned int x)
> {
> return clamp(10, 5, x == 0 ? 0 : x - 1);
> }
> which is never actually called with x <= 5.
> The compiler converts it to:
> return x < 0 ? clamp(10, 5, 0) : clamp(10, 5, x);
> (Probably because it can see that clamp(10, 5, 0) is constant.)
> And then the compile-time sanity check in clamp() fires.
>
> The order of the arguments to clamp is just wrong!
>
> David
>
The build is still failing with today's next, should the offending
commit be reverted?
Bartosz
Powered by blists - more mailing lists