public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/87628] Redundant check of pointer when operator delete is called
       [not found] <bug-87628-4@http.gcc.gnu.org/bugzilla/>
@ 2022-09-21  4:44 ` hiraditya at msn dot com
  2022-09-21  5:00 ` hiraditya at msn dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: hiraditya at msn dot com @ 2022-09-21  4:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87628

--- Comment #3 from AK <hiraditya at msn dot com> ---
Still happening with gcc trunk.

https://godbolt.org/z/5K94665GK

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/87628] Redundant check of pointer when operator delete is called
       [not found] <bug-87628-4@http.gcc.gnu.org/bugzilla/>
  2022-09-21  4:44 ` [Bug c++/87628] Redundant check of pointer when operator delete is called hiraditya at msn dot com
@ 2022-09-21  5:00 ` hiraditya at msn dot com
  2023-05-17 17:53 ` hiraditya at msn dot com
  2023-05-17 18:14 ` hiraditya at msn dot com
  3 siblings, 0 replies; 4+ messages in thread
From: hiraditya at msn dot com @ 2022-09-21  5:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87628

--- Comment #4 from AK <hiraditya at msn dot com> ---
Seems like clang now added the check:

$ clang++ -Oz -fno-exceptions

if_delete(char*):                         # @if_delete(char*)
        test    rdi, rdi
        jne     operator delete(void*)@PLT                      # TAILCALL
        ret

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/87628] Redundant check of pointer when operator delete is called
       [not found] <bug-87628-4@http.gcc.gnu.org/bugzilla/>
  2022-09-21  4:44 ` [Bug c++/87628] Redundant check of pointer when operator delete is called hiraditya at msn dot com
  2022-09-21  5:00 ` hiraditya at msn dot com
@ 2023-05-17 17:53 ` hiraditya at msn dot com
  2023-05-17 18:14 ` hiraditya at msn dot com
  3 siblings, 0 replies; 4+ messages in thread
From: hiraditya at msn dot com @ 2023-05-17 17:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87628

--- Comment #5 from AK <hiraditya at msn dot com> ---
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)`

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/87628] Redundant check of pointer when operator delete is called
       [not found] <bug-87628-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-05-17 17:53 ` hiraditya at msn dot com
@ 2023-05-17 18:14 ` hiraditya at msn dot com
  3 siblings, 0 replies; 4+ messages in thread
From: hiraditya at msn dot com @ 2023-05-17 18:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87628

--- Comment #6 from AK <hiraditya at msn dot com> ---
Opened a bug for clang as well:
https://github.com/llvm/llvm-project/issues/62783

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-17 18:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-87628-4@http.gcc.gnu.org/bugzilla/>
2022-09-21  4:44 ` [Bug c++/87628] Redundant check of pointer when operator delete is called hiraditya at msn dot com
2022-09-21  5:00 ` hiraditya at msn dot com
2023-05-17 17:53 ` hiraditya at msn dot com
2023-05-17 18:14 ` hiraditya at msn dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).