Re: [PATCH v3] kernel.h: Skip single-eval logic on literals in min()/max()
From: Linus Torvalds
Date: Fri Mar 09 2018 - 19:29:02 EST
On Fri, Mar 9, 2018 at 4:07 PM, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> A brief poke failed to reveal a workaround - gcc-4.4.4 doesn't appear
> to know that __builtin_constant_p(x) is a constant. Or something.
LOL.
I suspect it might be that it wants to evaluate
__builtin_choose_expr() at an earlier stage than it evaluates
__builtin_constant_p(), so it's not that it doesn't know that
__builtin_constant_p() is a constant, it just might not know it *yet*.
Maybe.
Side note, if it's not that, but just the "complex" expression that
has the logical 'and' etc, maybe the code could just use
__builtin_constant_p((x)+(y))
or something.
But yeah:
> Sigh. Wasn't there some talk about modernizing our toolchain
> requirements?
Maybe it's just time to give up on 4.4. We wanted 4.5 for "asm goto",
and once we upgrade to 4.5 I think Arnd said that no distro actually
ships it, so we might as well go to 4.6.
So maybe this is just the excuse to finally make that official, if
there is no clever workaround any more.
Linus