[Bug middle-end/115037] Unused std::vector is not optimized away.

2024-05-10 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115037

Xi Ruoyao  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |DUPLICATE

--- Comment #7 from Xi Ruoyao  ---
.

*** This bug has been marked as a duplicate of bug 109442 ***

[Bug middle-end/115037] Unused std::vector is not optimized away.

2024-05-10 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115037

--- Comment #6 from Jonathan Wakely  ---
Yes

[Bug middle-end/115037] Unused std::vector is not optimized away.

2024-05-10 Thread xry111 at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115037

Xi Ruoyao  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=109442
 CC||xry111 at gcc dot gnu.org

--- Comment #5 from Xi Ruoyao  ---
Isn't this an exact dup of PR109442?

[Bug middle-end/115037] Unused std::vector is not optimized away.

2024-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115037

--- Comment #4 from Andrew Pinski  ---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94293#c4

[Bug middle-end/115037] Unused std::vector is not optimized away.

2024-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115037

Andrew Pinski  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=94294

--- Comment #3 from Andrew Pinski  ---
Pr 94294

[Bug middle-end/115037] Unused std::vector is not optimized away.

2024-05-10 Thread hubicka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115037

Jan Hubicka  changed:

   What|Removed |Added

 CC||jason at redhat dot com,
   ||jwakely at redhat dot com

--- Comment #2 from Jan Hubicka  ---
I tried to look for duplicates, but did not find one.
However I think the first problem is that we do not optimize away the store of
1 to vector while clang does.  I think this is because we do not believe we can
trust that delete operator is safe?

We get:
void test ()
{
  int * test$D25839$_M_impl$D25146$_M_start;
  struct vector test;
  int * _61;

   [local count: 1073741824]:
  _61 = operator new (4);

   [local count: 1063439392]:
  *_61 = 1;
  operator delete (_61, 4);
  test ={v} {CLOBBER};
  test ={v} {CLOBBER(eol)};
  return;

   [count: 0]:
:
  test ={v} {CLOBBER};
  resx 2

}
If we can not trust fact that operator delete is good, perhaps we can arrange
explicit clobber before calling it? I think it is up to std::vector to decide
what it will do with the stored array so in this case even instane oprator
delete has no right to expect that the data in vector will be sane :)

[Bug middle-end/115037] Unused std::vector is not optimized away.

2024-05-10 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115037

--- Comment #1 from Andrew Pinski  ---
This might be a dup of another bug which talks about the same thing.