[Bug c++/87628] Redundant check of pointer when operator delete is called
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87628 --- Comment #6 from AK --- Opened a bug for clang as well: https://github.com/llvm/llvm-project/issues/62783
[Bug c++/87628] Redundant check of pointer when operator delete is called
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87628 --- Comment #5 from AK --- As per: https://en.cppreference.com/w/cpp/memory/new/operator_delete """ In all cases, if ptr is a null pointer, the standard library deallocation functions do nothing. If the pointer passed to the standard library deallocation function was not obtained from the corresponding standard library allocation function, the behavior is undefined. """ So it should be fine to remove the check `if(p)`
[Bug c++/87628] Redundant check of pointer when operator delete is called
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87628 --- Comment #4 from AK --- Seems like clang now added the check: $ clang++ -Oz -fno-exceptions if_delete(char*): # @if_delete(char*) testrdi, rdi jne operator delete(void*)@PLT # TAILCALL ret
[Bug c++/87628] Redundant check of pointer when operator delete is called
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87628 --- Comment #3 from AK --- Still happening with gcc trunk. https://godbolt.org/z/5K94665GK
[Bug c++/87628] Redundant check of pointer when operator delete is called
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87628 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org --- Comment #2 from Eric Gallager --- (In reply to Richard Biener from comment #1) > Confirmed. IIRC there are duplicates of this bug. Well related bugs for the plain-C equivalent with free() at least
[Bug c++/87628] Redundant check of pointer when operator delete is called
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87628 Richard Biener changed: What|Removed |Added Keywords||missed-optimization Status|UNCONFIRMED |NEW Last reconfirmed||2018-10-17 Ever confirmed|0 |1 --- Comment #1 from Richard Biener --- Confirmed. IIRC there are duplicates of this bug.