summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzat Khuzhin <azat@libevent.org>2023-05-14 22:35:53 +0200
committerAzat Khuzhin <azat@libevent.org>2023-05-14 22:35:53 +0200
commitfe610f2cdcca98402ec6d104ab6b565699dcc3e6 (patch)
treea134ebd310f3c1a604b2df7658d05858a00b1aad
parent13f5552336f3b38f8bf9c7c33f28e785946565f5 (diff)
downloadlibevent-fe610f2cdcca98402ec6d104ab6b565699dcc3e6.tar.gz
Fix util/mm_calloc_enomem under FreeBSD
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>
-rw-r--r--test/regress_util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/regress_util.c b/test/regress_util.c
index 430b3cdd..a3dc04ce 100644
--- a/test/regress_util.c
+++ b/test/regress_util.c
@@ -1335,7 +1335,7 @@ test_event_calloc_enomem(void *arg)
#elif defined(__GNUC__)
#pragma GCC diagnostic pop
#endif
- tt_assert(p == NULL);
+ tt_ptr_op(p, ==, NULL);
tt_int_op(errno, ==, ENOMEM);
end: