All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Joe Perches <joe@perches.com>,
	Nathan Chancellor <nathan@kernel.org>,
	 "Sudip Mukherjee (Codethink)" <sudipm.mukherjee@gmail.com>,
	Masahiro Yamada <masahiroy@kernel.org>,
	 Michal Marek <michal.lkml@markovi.net>,
	linux-kbuild@vger.kernel.org,  linux-kernel@vger.kernel.org,
	clang-built-linux <llvm@lists.linux.dev>,
	 Justin Stitt <justinstitt@google.com>
Subject: Re: mainline build failure for arm64 allmodconfig with clang
Date: Thu, 11 Aug 2022 15:28:11 -0700	[thread overview]
Message-ID: <CAHk-=wiW_LjFRE9wFMj-j2gp9=u8jqrMVZtT3n4-oJWtQ6E0iQ@mail.gmail.com> (raw)
In-Reply-To: <CAKwvOdkUc=8DD938in5PMeGYAn3PEWp4E_W8qEHq_y7Smy8+mQ@mail.gmail.com>

On Thu, Aug 11, 2022 at 3:04 PM Nick Desaulniers
<ndesaulniers@google.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

  reply	other threads:[~2022-08-11 22:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11  7:36 mainline build failure for arm64 allmodconfig with clang Sudip Mukherjee (Codethink)
2022-08-11 15:02 ` Nathan Chancellor
2022-08-11 15:39   ` Linus Torvalds
2022-08-11 18:39     ` Nick Desaulniers
2022-08-11 19:35       ` Linus Torvalds
2022-08-11 22:04         ` Nick Desaulniers
2022-08-11 22:28           ` Linus Torvalds [this message]
2022-09-01 17:59             ` [PATCH] Makefile.extrawarn: re-enable -Wformat for clang; take 2 Nick Desaulniers
2022-09-01 18:06               ` Nathan Chancellor
2022-09-03 18:22               ` Masahiro Yamada
2022-08-15 10:37         ` mainline build failure for arm64 allmodconfig with clang David Laight

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='CAHk-=wiW_LjFRE9wFMj-j2gp9=u8jqrMVZtT3n4-oJWtQ6E0iQ@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=justinstitt@google.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=sudipm.mukherjee@gmail.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.