[Bug rtl-optimization/51353] GCC incorrectly optimizes away assignment to return address
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51353 Andrew Pinski pinskia at gcc dot gnu.org changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID --- Comment #3 from Andrew Pinski pinskia at gcc dot gnu.org 2012-01-04 00:37:33 UTC --- __builtin_frame_address(0) points to an address on the stack which means at the end of the function, it can be removed. The tricks you are doing require the use of volatile so that the compiler cannot remove it.
[Bug rtl-optimization/51353] GCC incorrectly optimizes away assignment to return address
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51353 --- Comment #1 from Andrew Pinski pinskia at gcc dot gnu.org 2011-12-14 23:28:00 UTC --- I think this should be: *(((volatile void **)__builtin_frame_address(0))+1) = exc; GCC thinks it does not alias thing which is why it is removing it.
[Bug rtl-optimization/51353] GCC incorrectly optimizes away assignment to return address
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51353 --- Comment #2 from Nathan Keynes nkeynes at deadcoderemoval dot net 2011-12-15 02:14:48 UTC --- Testing this out, *(((volatile void **)__builtin_frame_address(0))+1) = exc; still does not work in 4.4.6 and 4.5.3, but *(((void * volatile *)__builtin_frame_address(0))+1) = exc; does work correctly.