This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Re: Why does gcc generate const local array on stack?


Richard, thanks for explanation. I found an option
-fmerge-all-constants, which can help me work around for now.

BIngfeng

On Thu, Apr 21, 2016 at 11:15 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Thu, Apr 21, 2016 at 11:39 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>> On 21 April 2016 at 03:41, lh_mouse wrote:
>>> See this example: http://coliru.stacked-crooked.com/a/048b4aa5046da11b
>>>
>>> In this example the function is called recursively.
>>
>> See the original email you replied to:
>>
>> "I understand if this function is recursive and pointer of the array
>> is involved, GCC would have to maintain the array on stack and hence
>> the initialization."
>>
>> The question is about cases where that doesn't happen.
>
> The decision on whether to localize the array and inline the init is
> done at gimplification time.
> The plan is to delay this until SRA which could then also apply the
> desired optimization
> of removing the local in case it is never written to.
>
> Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]