------- Comment #8 from howarth at nitro dot med dot uc dot edu 2010-09-04 19:13 ------- (In reply to comment #7) > I fixed the test case to not expect the unimplemented optimization in r157197, > however, it would be nice to ensure the async signal handlers can handle > unaligned stacks and to perform this optimization. I'm fairly certain the > signal handers have to cope as code gen can do: > > _h: > subl $12, %esp > movl $1, %eax > addl $12, %esp > ret > > for int h () { return 1; } and certainly we can take a signal at _h+0, where > esp isn't aligned. Given that, we can omit sp alignments for leaf functions > (and no tail calls either), even on machines where otherwise an alignment is > required, as long as any variables on the stack are correctly aligned. > > When this optimization is added, we can undo the r157197 change. >
My proposed patch to fix PR36502... http://gcc.gnu.org/ml/gcc-patches/2010-09/msg00237.html that enables stack realignment on intel darwin also solves this PR as well. Comparing the output from gcc trunk before and after my patch, I see... --- builtin-unreachable.s 2010-09-04 15:12:40.000000000 -0400 +++ builtin-unreachable.trunk_patched 2010-09-04 15:02:45.000000000 -0400 @@ -3,11 +3,7 @@ .globl _h _h: LFB0: - subl $12, %esp -LCFI0: movl $1, %eax - addl $12, %esp -LCFI1: ret LFE0: .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support @@ -39,16 +35,6 @@ .set L$set$2,LFE0-LFB0 .long L$set$2 .byte 0 - .byte 0x4 - .set L$set$3,LCFI0-LFB0 - .long L$set$3 - .byte 0xe - .byte 0x10 - .byte 0x4 - .set L$set$4,LCFI1-LCFI0 - .long L$set$4 - .byte 0xe - .byte 0x4 .align 2 LEFDE1: .subsections_via_symbols -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42313