[Bug c++/97151] GCC fails to optimize away uselessly allocated arrays (C++)

2020-09-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97151 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c++/97151] GCC fails to optimize away uselessly allocated arrays (C++)

2020-09-23 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97151 --- Comment #9 from CVS Commits --- The master branch has been updated by Richard Biener : https://gcc.gnu.org/g:9e64f17d044767248175fece80a2759d94c45fc4 commit r11-3386-g9e64f17d044767248175fece80a2759d94c45fc4 Author: Richard Biener Date:

[Bug c++/97151] GCC fails to optimize away uselessly allocated arrays (C++)

2020-09-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97151 --- Comment #8 from Jonathan Wakely --- (In reply to Richard Biener from comment #7) > (IIRC there's > only ever a single argument to operator delete). That's not always true. See -fsized-deallocation

[Bug c++/97151] GCC fails to optimize away uselessly allocated arrays (C++)

2020-09-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97151 Richard Biener changed: What|Removed |Added CC||rguenth at gcc dot gnu.org --- Comment

[Bug c++/97151] GCC fails to optimize away uselessly allocated arrays (C++)

2020-09-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97151 --- Comment #6 from Richard Biener --- (In reply to Marat Radchenko from comment #4) > (In reply to Martin Liška from comment #3) > > It's caused by what was mentioned as 2) which transforms to: > > > > _6 = operator new [] (40); > > __built

[Bug c++/97151] GCC fails to optimize away uselessly allocated arrays (C++)

2020-09-22 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97151 --- Comment #5 from Jonathan Wakely --- Yes, operator new[](40) cannot return null, and passing null to memset is undefined, so we could assume it is never called with null.

[Bug c++/97151] GCC fails to optimize away uselessly allocated arrays (C++)

2020-09-22 Thread marat at slonopotamus dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97151 --- Comment #4 from Marat Radchenko --- (In reply to Martin Liška from comment #3) > It's caused by what was mentioned as 2) which transforms to: > > _6 = operator new [] (40); > __builtin_memset (_6, 0, 40); > operator delete [] (_6); >

[Bug c++/97151] GCC fails to optimize away uselessly allocated arrays (C++)

2020-09-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97151 --- Comment #3 from Martin Liška --- It's caused by what was mentioned as 2) which transforms to: _6 = operator new [] (40); __builtin_memset (_6, 0, 40); operator delete [] (_6); So there's a use of _6 and we probably can't remove it as

[Bug c++/97151] GCC fails to optimize away uselessly allocated arrays (C++)

2020-09-21 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97151 Richard Biener changed: What|Removed |Added CC||marxin at gcc dot gnu.org Key

[Bug c++/97151] GCC fails to optimize away uselessly allocated arrays (C++)

2020-09-21 Thread marat at slonopotamus dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97151 --- Comment #1 from Marat Radchenko --- Another program that exhibits the same behavior: int main() { int *a = new int[10]; a[0] = 0; delete[] a; return 0; }