This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/78104] optimizer doesn't grok C++ new/delete yet


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]