On 04/01/2016 01:06 PM, Jake Hamby wrote:
Dead store elimination is the most likely candidate. It "knows" that stores into the local frame are dead when the function returns and uses that information to eliminate such stores.My theory is that it has to do with liveness detection and a write into the stack frame being incorrectly seen as updating a local variable, but that could be completely wrong. I was hoping that by cc'ing gcc-patches that somebody more familiar with why some phase of the optimizer might decide to delete this particular insn that copies data into the stack (to overwrite the return address, e.g. to move to EH_RETURN_HANDLER_RTX) immediately before returning.
You may just need to set the volatile flag on the MEM when you generate it in your backend. For example see config/pa/pa.c::pa_eh_return_handler_rtx.
Jeff