[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240527212525.GF2118490@ZenIV>
Date: Mon, 27 May 2024 22:25:25 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: netdev@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH][CFT][experimental] net/socket.c: use straight
fdget/fdput (resend)
On Mon, May 27, 2024 at 05:31:16PM +0100, Al Viro wrote:
> Hell knows; let me play with that a bit and let's see what falls out...
gcc optimizer is... interesting:
if (v & 1)
if (!(v & 3))
foo();
is *NOT* collapsed into a no-op. Not even
if (v & 1)
if (!(v & 1) && !(v & 2))
foo();
is good enough for it.
if (v & 1)
if (!(v & 1))
if (!(v & 2))
foo();
is recognized, thankfully, but... WTF? As far as I can tell,
if (!(v & 1) && !(v & 2))
gets turned into if (!(v & 3)), and then gcc gets stuck on that.
if (!(v & 1)) if (!(v & 2))
is turned into the same, but apparently only after it actually
looks at both parts in context of what it knows about the earlier
checks.
clang handles all forms just fine, but gcc does not ;-/
Powered by blists - more mailing lists