mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
fe610f2cdc
It looks like the compiler optimizes this call out with tt_assert(): (gdb) disas /m test_event_calloc_enomem Dump of assembler code for function test_event_calloc_enomem: 0x0000000000293bb0 <+0>: push %rbp 0x0000000000293bb1 <+1>: mov %rsp,%rbp 0x0000000000293bb4 <+4>: call 0x29f510 <__error@plt> 0x0000000000293bb9 <+9>: movl $0x0,(%rax) 0x0000000000293bbf <+15>: call 0x2990e0 <tinytest_set_test_failed_> 0x0000000000293bc4 <+20>: mov $0x2168e4,%edi 0x0000000000293bc9 <+25>: mov $0x220582,%esi 0x0000000000293bce <+30>: mov $0x20d893,%edx 0x0000000000293bd3 <+35>: mov $0x53a,%ecx 0x0000000000293bd8 <+40>: xor %eax,%eax 0x0000000000293bda <+42>: call 0x29f3b0 <printf@plt> 0x0000000000293bdf <+47>: mov $0x20da72,%edi 0x0000000000293be4 <+52>: mov $0x20f731,%esi 0x0000000000293be9 <+57>: xor %eax,%eax 0x0000000000293beb <+59>: pop %rbp 0x0000000000293bec <+60>: jmp 0x29f3b0 <printf@plt> While with tt_ptr_op() it does not: (gdb) disas /m test_event_calloc_enomem Dump of assembler code for function test_event_calloc_enomem: 0x0000000000293bd0 <+0>: push %rbp 0x0000000000293bd1 <+1>: mov %rsp,%rbp 0x0000000000293bd4 <+4>: push %rbx 0x0000000000293bd5 <+5>: push %rax 0x0000000000293bd6 <+6>: call 0x29f610 <__error@plt> 0x0000000000293bdb <+11>: movl $0x0,(%rax) 0x0000000000293be1 <+17>: mov $0xffffffffffffffff,%rdi 0x0000000000293be8 <+24>: mov $0xffffffffffffffff,%rsi 0x0000000000293bef <+31>: call 0x2a01c0 <calloc@plt> 0x0000000000293bf4 <+36>: test %rax,%rax 0x0000000000293bf7 <+39>: je 0x293c2b <test_event_calloc_enomem+91>