[Bug target/34879] __builtin_setjmp / __builtin_longjmp fails stack frame address with O2, O3 and Os

hutchinsonandy at aim dot com gcc-bugzilla@gcc.gnu.org
Sat Mar 29 11:37:00 GMT 2008



------- Comment #1 from hutchinsonandy at aim dot com  2008-03-29 11:37 -------
Created an attachment (id=15395)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15395&action=view)
Setjmp patch for AVR

The attached patch is a fix for AVR target. MIPS does something similar to get
around same issue.

The real problem is with gcc builin setjmp receiver being removed by
optimizers.
Optimizers think that frame_pointer load in receiver is unneeded and remove it! 

The patch loads the frame pointer in the nonlocal_goto, making the receiver
(where it jumps to) empty, so bad optimization cannot remove it. Additionally,
it avoids the unnecessary arithmetic around frame pointer offsets.

This patch was tested and the testcase passes.

Further changes may be required in the future if AVR 24bit jumps are to be
supported.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34879



More information about the Gcc-bugs mailing list