[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wiW_LjFRE9wFMj-j2gp9=u8jqrMVZtT3n4-oJWtQ6E0iQ@mail.gmail.com>
Date: Thu, 11 Aug 2022 15:28:11 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Nick Desaulniers <ndesaulniers@...gle.com>
Cc: Joe Perches <joe@...ches.com>,
Nathan Chancellor <nathan@...nel.org>,
"Sudip Mukherjee (Codethink)" <sudipm.mukherjee@...il.com>,
Masahiro Yamada <masahiroy@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
clang-built-linux <llvm@...ts.linux.dev>,
Justin Stitt <justinstitt@...gle.com>
Subject: Re: mainline build failure for arm64 allmodconfig with clang
On Thu, Aug 11, 2022 at 3:04 PM Nick Desaulniers
<ndesaulniers@...gle.com> wrote:
>
> Yeah, I guess adding a truncate to the caller is kind of unnecessary
> if you're still going to use %hhd anyways. What are your thoughts on
> this bug I've filed?
> https://github.com/llvm/llvm-project/issues/57102
I really wish that bug report was about how *wrong* it is to warn
about that thing.
Sure, a cast adds pointless code to the caller, and is overhead, but
that isn't really the argument here.
The argument really is that "if you force the value to always be a
char, then %hhd is pointless"
Basically, %hhu and %hhd simply do not make sense if you always
require the value to be cast to the right range, because for those
cases the much simpler and more straightforward %d and %u already
work.
So a warning that says "you didn't cast it to the rigth range" is
truly fundamentally broken.
So it's not about "a cast generates worse code". It's really about
"that warning is WRONG".
Linus
Powered by blists - more mailing lists