Greetings everyone,
gcc 4.4/gcc 4.5
int *p = NULL;
gcc 4.4/gcc 4.5
int *p = NULL;
delete p;
0x08049fe5 <+0>: push %ebp0x08049fe6 <+1>: mov %esp,%ebp0x08049fe8 <+3>: and $0xfffffff0,%esp0x08049feb <+6>: sub $0x20,%esp0x08049fee <+9>: call 0x8048fb4 <mcount@plt>0x08049ff3 <+14>: movl $0x0,0x1c(%esp)0x08049ffb <+22>: mov 0x1c(%esp),%eax0x08049fff <+26>: mov %eax,(%esp)0x0804a002 <+29>: call 0x8048e54 <_ZdlPv@plt>0x0804a007 <+34>: mov $0x1,%eax0x0804a00c <+39>: leave0x0804a00d <+40>: ret
int *p = NULL;
delete[] p;
0x08049fe5 <+0>: push %ebp0x08049fe6 <+1>: mov %esp,%ebp0x08049fe8 <+3>: and $0xfffffff0,%esp0x08049feb <+6>: sub $0x20,%esp0x08049fee <+9>: call 0x8048fa4 <mcount@plt>0x08049ff3 <+14>: movl $0x0,0x1c(%esp)0x08049ffb <+22>: cmpl $0x0,0x1c(%esp)0x0804a000 <+27>: je 0x804a00e <main+41>0x0804a002 <+29>: mov 0x1c(%esp),%eax0x0804a006 <+33>: mov %eax,(%esp)0x0804a009 <+36>: call 0x8048fc4 <_ZdaPv@plt>0x0804a00e <+41>: mov $0x1,%eax0x0804a013 <+46>: leave
0x0804a014 <+47>: ret
So, we are not calling ::operator delete[] in case of NULL-pointer.
0x08049ffb <+22>: cmpl $0x0,0x1c(%esp)
0x0804a000 <+27>: je 0x804a00e <main+41>
Any comments?
No comments:
Post a Comment