linux-toolchains.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org,
	linux-toolchains@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: Linux 6.3-rc3
Date: Mon, 20 Mar 2023 16:41:52 -0700	[thread overview]
Message-ID: <CAHk-=whf82-im76ovESE2RZBh5=Y3uR1GDbae60=TWjM7OkLdA@mail.gmail.com> (raw)
In-Reply-To: <20230320220631.GA637514@dev-arch.thelio-3990X>

On Mon, Mar 20, 2023 at 3:06 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> Right, this seems like a subtle difference in semantics between
> -Wuninitialized between clang and GCC.

I guess it's a bit ambiguous whether it's

 "X may be USED uninitialized"

or whether it is

 "X may BE uninitialized"

and then depending on how you see that ambiguity, the control flow matters.

In this case, there is absolutely no question that the variable is
uninitialized (since there is no write to it at all).

So it is very clearly and unambiguously uninitialized. And I do think
that as a result, "-Wuninitialized" should warn.

But at the same time, whether it is *used* or not depends on that
conditional, so I can see how it could be confusing and not be so
clear an unambiguous.

On the whole, I do wish that the logic would be "after dead code
removal, if some pseudo has no initializer, it should always warn,
regardless of any remaining dynamic conditoinals".

That "after dead code removal" might matter, because I could see where
config things (#ifdef's etc) would just remove the initialization of
some variable, and if the use is behind some static "if (0)", then
warning about it is all kinds of silly.

                     Linus

      parent reply	other threads:[~2023-03-20 23:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAHk-=wiPd8R8-zSqTOtJ9KYeZLBByHug7ny3rgP-ZqzpP_KELg@mail.gmail.com>
     [not found] ` <20230320180501.GA598084@dev-arch.thelio-3990X>
     [not found]   ` <CAHk-=wgSqpdkeJBb92M37JNTdRQJRnRUApraHKE8uGHTqQuu2Q@mail.gmail.com>
2023-03-20 18:53     ` Linux 6.3-rc3 Nathan Chancellor
2023-03-20 19:22       ` Nathan Chancellor
2023-03-22 12:44       ` Kalle Valo
2023-03-22 16:36         ` Nathan Chancellor
2023-03-22 20:36           ` Nathan Chancellor
2023-03-24 10:54           ` Kalle Valo
2023-03-24 15:11             ` Nathan Chancellor
2023-03-24 15:23               ` Kalle Valo
2023-03-28 19:07                 ` Nathan Chancellor
2023-03-29  8:39                   ` Kalle Valo
2023-03-22 16:40         ` Sedat Dilek
2023-03-22 16:55           ` Linus Torvalds
2023-03-22 18:17             ` Nick Desaulniers
2023-03-24 17:16             ` Masahiro Yamada
2023-03-27 16:12               ` Jani Nikula
2023-03-27 17:03                 ` Kalle Valo
     [not found]     ` <4adbed5a-6f73-42ac-b7be-e12c764ae808@roeck-us.net>
     [not found]       ` <CAHk-=wgyJREUR1WgfFmie5XVJnBLr1VPVbSibh1+Cq57Bh4Tag@mail.gmail.com>
2023-03-20 22:06         ` Nathan Chancellor
2023-03-20 22:48           ` Segher Boessenkool
2023-03-20 23:41           ` Linus Torvalds [this message]

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-=whf82-im76ovESE2RZBh5=Y3uR1GDbae60=TWjM7OkLdA@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).