http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60770
Bug ID: 60770 Summary: disappearing clobbers Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: glisse at gcc dot gnu.org Hello, looking at Manuel's testcase from PR 60517, I notice that EINLINE changes: D.2253 = A::getB (&a); to: D.2264 = a.b; D.2263 = D.2264; D.2253 = D.2263; (several copies, but only the original D.2253 has a clobber) and ESRA changes: D.2253 = D.2263; D.2253 ={v} {CLOBBER}; _5 = MEM[(double *)&D.2253]; to: D.2253 = D.2263; SR.1_3 = MEM[(struct B *)&D.2263]; D.2253 ={v} {CLOBBER}; _5 = SR.1_3; The clobber then disappears in release_ssa. It is correct, but not so helpful, because it hides the fact that we are reading from dead memory. If I disable ESRA, the clobber and the memory read are still present in the right order in the .optimized dump at -O3. Would it be possible to keep the memory read after the clobber, without affecting performance? class B { public: double x[2]; }; class A { B b; public: B getB(void) { return b; } }; double foo(A a) { double * x = &(a.getB().x[0]); return x[0]; }