assembly - Adding 0 to a register causes bug to go away? -


i having extremely hard time tracking down assembly bug, , appreciate help.

i have tracked bug down 1 spot, , confusing hell out of me:

not_object:         movq _stanza_header(%rip), %rbp         movq c_rsp_offset(%rbp), %rsp         andq $-16, %rsp         addq $0, %rsp    // code not work without line         call _gc_failure 

for reason, adding in dummy statement (addq $0, %rsp) makes code work, , without it, not.

does know how behaviour possibly arise? not dynamically loading code heap, don't believe overwriting code somehow without segfault.

i using apple's i686-apple-darwin10-gcc-4.2.1 assemble code, on 64-bit intel machine.

thanks help! -patrick


the resulting machine code (as disassembled gdb) matches wrote:

not_object: 0x000000010001060e <not_object+0>:  mov    0xabb(%rip),%rbp        # 0x1000110d0 <stanza_header> 0x0000000100010615 <not_object+7>:  mov    0x58(%rbp),%rsp 0x0000000100010619 <not_object+11>: ,    $0xfffffffffffffff0,%rsp 0x000000010001061d <not_object+15>: add    $0x0,%rsp 0x0000000100010621 <not_object+19>: callq  0x10000173f <gc_failure> 

so suppose should rule out buggy assembler cause.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -