------- Comment #5 from rguenth at gcc dot gnu dot org 2005-11-21 14:06 ------- Disassembly with the first two checks removed (only the third aborts):
foo: .LFB2: subq $24, %rsp #, .LCFI0: movl x+8(%rip), %eax #, tmp62 movl 16(%rsp), %edx #, tmp60 movq %rdi, 8(%rsp) # a, a andl $2147483647, %eax #, tmp62 andl $2147483647, %edx #, tmp60 cmpl %eax, %edx # tmp62, tmp60 jne .L6 #, addq $24, %rsp #, ret .L6: call abort # main: .LFB3: subq $8, %rsp #, .LCFI1: movl x+8(%rip), %eax #, tmp62 movw $30216, x(%rip) #, x.a movb $1, x+4(%rip) #, x.b.c.d movq x(%rip), %rdi # x, x andl $-2147483648, %eax #, tmp62 orl $32766, %eax #, tmp62 movl %eax, x+8(%rip) # tmp62, call foo # xorl %eax, %eax # <result> addq $8, %rsp #, ret it looks like we are confused on where we passed the structure by value. It's in %rdi and %eax, while we think it got passed on stack(!?) in foo. Someone with more x86_64 ABI knowledge has to look into this. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24969