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.

Reply via email to