[Bug c++/78104] optimizer doesn't grok C++ new/delete yet
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 25 06:18:00 GMT 2016
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.
More information about the Gcc-bugs
mailing list