This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/78104] optimizer doesn't grok C++ new/delete yet
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 25 Oct 2016 05:57:49 +0000
- Subject: [Bug c++/78104] optimizer doesn't grok C++ new/delete yet
- Auto-submitted: auto-generated
- References: <bug-78104-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78104
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Markus Trippelsdorf from comment #0)
> A simple example:
>
> int main() {
> int *ob = new int();
> delete ob;
> }
>
> clang optimizes it away:
Which is funny considering what Chris Lattner wrote in PR 23383 comment #4:
This would not be legal, there is no reason operator new can't return a pointer
that already exists in the program.