[Bug c++/91761] New: Overloaded new operator compiled with -O3 option distorts original C++ code

2019-09-12 Thread redsoftk at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91761

Bug ID: 91761
   Summary: Overloaded new operator compiled with -O3 option
distorts original C++ code
   Product: gcc
   Version: 7.4.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: redsoftk at yahoo dot com
  Target Milestone: ---

Created attachment 46878
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46878&action=edit
simple sample to reproduce the problem

Starting from gcc ver 7.4 (versions <=5.4 worked correctly) the code
implementing overloading new operators produces strange binary: in the case of
filling allocated memory with some values the compiler produces 0-value
assignments instead of assignment actual variables.
Attached is the simple example showing the problem. 
To compile it use g++ with simple options:
 g++ -c -Wextra -Wall -O3 -o OverloadedNewGccBug.o OverloadedNewGccBug.cpp
 g++ -o Test OverloadedNewGccBug.o
Then run the Test executable.

[Bug c++/91761] Overloaded new operator compiled with -O3 option distorts original C++ code

2019-09-12 Thread redsoftk at yahoo dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91761

Sergey Krasnitsky  changed:

   What|Removed |Added

 Resolution|INVALID |FIXED

--- Comment #2 from Sergey Krasnitsky  ---
1) It doesn't remove these assignments, instead it assigns to 0.
2) No any warning pointing to the unusable assignment.
3) No backward compatibility: worked code now stopped to run.