[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8736x1gkns.fsf@concordia.ellerman.id.au>
Date: Tue, 03 Jul 2018 11:41:59 +1000
From: Michael Ellerman <mpe@...erman.id.au>
To: Segher Boessenkool <segher@...nel.crashing.org>
Cc: Kees Cook <keescook@...omium.org>, Arnd Bergmann <arnd@...db.de>,
Paul Mackerras <paulus@...ba.org>,
Anatolij Gustschin <agust@...x.de>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] powerpc: mpc5200: Remove VLA usage
Segher Boessenkool <segher@...nel.crashing.org> writes:
> On Mon, Jul 02, 2018 at 11:33:32AM +1000, Michael Ellerman wrote:
>> What if we write it:
>>
>> char saved_0x500[0x600 - 0x500];
>>
>> Hopefully the compiler is smart enough not to generate a VLA for that :)
>
> It is a VLA if the array size is not an integer constant expression. This
> is defined by C; the compiler has nothing to do with it. 0x600-0x500 is
> an integer constant expression, so this is not a VLA.
Thanks.
That wasn't meant as a dig at GCC. Kees had an epic struggle with the
kernel's min/max() macros which were causing expressions that looked
like they should be constant to generate VLAs.
> But if you meant if GCC will ever do a dynamic stack allocation for a fixed
> size local variable: yes indeed, I hope not!
Hey that would be cool, just-in-time local variable allocation :)
cheers
Powered by blists - more mailing lists