This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Frame pointer, bug or feature? (x86)
- From: Hendrik Greving <hendrik dot greving dot intel at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Andrew Pinski <pinskia at gmail dot com>, GCC Development <gcc at gcc dot gnu dot org>
- Date: Mon, 18 Nov 2013 12:43:50 -0800
- Subject: Re: Frame pointer, bug or feature? (x86)
- Authentication-results: sourceware.org; auth=none
- References: <CANc4vhoN4_zvYsSCpa-kjZ3XBT1KMNbAkHNCy=ORrt=fihquwg at mail dot gmail dot com> <CA+=Sn1=pK13xk0xVCiJiPjHdX38KXU3V43T1TEpwXeUyMuNYvQ at mail dot gmail dot com> <CANc4vhqm0fajt9v540oGpfwta2d2G+aeTocvvxJBRkDDs6Ry7g at mail dot gmail dot com> <CA+=Sn1kVvCofmgqyS6BJYLW_nExcODqXxx8sk3keiyTEziJJcQ at mail dot gmail dot com> <CANc4vhoAyyXJM6514qzXdMXprPrR2Ut_2+9Kh-8mtH0W7KJe0Q at mail dot gmail dot com> <20131118194844 dot GJ892 at tucnak dot redhat dot com>
Hmm don't VLA's obey the same lifetime rules as regular automatic
arrays on the stack?
On Mon, Nov 18, 2013 at 11:48 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Mon, Nov 18, 2013 at 11:22:22AM -0800, Hendrik Greving wrote:
>> Interesting, I just read up on it and I didn't know that. Thanks. Is
>> it correct to say though that it is a missing optimization and
>> frame_pointer_needed shouldn't evaluate to true?
>
> Certainly not unconditionally. It depends on the size and in which scope
> it is declared. If user meant to use a VLA and compiler optimizes it into
> non-VLA, then it isn't deallocated at the end of it's scope, so if it e.g.
> is very large or there are many of those, the optimization can break valid
> programs (especially if it's scope isn't the function scope but some smaller
> scope).
>
> Jakub