[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CA+55aFxjR5=0uQ7JVUs=aZp0frtBZorAvsPeXk6GYbQJZ_VU+Q@mail.gmail.com>
Date: Thu, 5 Apr 2018 19:02:11 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: James Y Knight <jyknight@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Matthias Kaehlcke <mka@...omium.org>,
Arnd Bergmann <arnd@...db.de>, Ingo Molnar <mingo@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Chandler Carruth <chandlerc@...gle.com>,
Stephen Hines <srhines@...gle.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Kees Cook <keescook@...gle.com>,
Guenter Roeck <groeck@...omium.org>,
Greg Hackmann <ghackmann@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [GIT PULL] x86/build changes for v4.17
On Thu, Apr 5, 2018 at 3:51 PM, James Y Knight <jyknight@...gle.com> wrote:
>
> Unfortunately, that behavior is required by the standard, it's not up to
> compiler optimization to change.
I actually mis-read your example - in your case it obviously does pass
the array itself down to the call, and yes, it obviously needs to be
allocated.
I had a test-case at one point where gcc avoided the stack allocation
entirely for a regular array, but not for a VLA (of the same constant
size) because the VLA logic is apparently different enough - even when
the size of the array is a compile-time constant.
We had that issue because we had a lot of trouble coming up with a
"max()" macro that was still an I-C-E (and we had a number of array
sizes that used "max()"). So all the array sizes were compile-time
constants, they just weren't traditional C arrays.
But now I can't recreate the thing. Maybe I had screwed up in my
test-case somehow.
Linus
Powered by blists - more mailing lists