https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60580
Wilco <wdijkstr at arm dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wdijkstr at arm dot com --- Comment #8 from Wilco <wdijkstr at arm dot com> --- (In reply to Jiong Wang from comment #7) > I'd take this for long term, hopefully could find a acceptable solution. > > X86 is default with -fomit-frame-pointer which makes the logic a little bit > simpler, and thus X86 could survive in more normal case, but still fail in > some corner cases. > > the fundamental problem is aarch64 and also x86 want to implement a finer > control of frame pointer which let leaf function be possible without setting > up frame record even under -fno-omit-frame-pointer. While gcc generic code > is not aware of that. Besides the solutions we discussed on the list to fix the underlying issues in the mid-end, a workaround may be possible in the backend. If we can guarantee a callback is made to the backend at the end of compilation of each function, then we can restore the original value of the omit-frame-pointer variable. This means the options code will never see the fake value, and attributes will work as expected. In principle any callback would work as long as the frame pointer variable is not used for that function again, and it happens before entering the options code again. Obviously this is a nasty hack, but at least it works.