[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=whf82-im76ovESE2RZBh5=Y3uR1GDbae60=TWjM7OkLdA@mail.gmail.com>
Date: Mon, 20 Mar 2023 16:41:52 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Guenter Roeck <linux@...ck-us.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
dri-devel@...ts.freedesktop.org, linux-toolchains@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: Linux 6.3-rc3
On Mon, Mar 20, 2023 at 3:06 PM Nathan Chancellor <nathan@...nel.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
Powered by blists - more mailing lists