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.guent...@gmail.com> wrote: > On Thu, Apr 21, 2016 at 11:39 AM, Jonathan Wakely <jwakely....@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.