http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50251
--- Comment #3 from vries at gcc dot gnu.org 2011-09-01 13:06:45 UTC --- Created attachment 25162 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25162 optimized dump 1. The alloca in main is transformed into this declaration: <unnamed-unsigned:8> D.2129[24]; and accessed like this: iftmp.6_13 = MEM[symbol: D.2129, index: ivtmp.30_31, step: 4, offset: 4294967292B]; MEM[symbol: D.2129, index: ivtmp.30_31, step: 4, offset: 0B] = D.2105_15; D.2099_18 = MEM[(int *)&D.2129][5]{lb: 0 sz: 4}; MEM[symbol: D.2129, index: ivtmp.30_31, step: 4, offset: 0B] = 0; 2. __builtin_stack_restore/__builtin_stack_restore in main are not optimized away, because the restored value is potentially used. The restored value is the same as the current value, so the restore is redundant, but that's not checked in optimize_stack_restore. saved_stack.3_5 = __builtin_stack_save (); __builtin_stack_restore (saved_stack.3_5);