https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94064
Bug ID: 94064 Summary: 00 vs O1/O2/O3 different output Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: paul.hua.gm at gmail dot com Target Milestone: --- #include <stdio.h> #include <new> class A { public: A() {}; int m; }; int main() { A* src = new A; src->m = 10; A* src_p = new(src) A; printf("%d\n", src->m); } g++ foo.cpp -O3 -o 3 ./3 >> 0 g++ foo.cpp -O0 -o 0 ./0 >> 10