http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50346
Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c++ |tree-optimization --- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-10-12 10:10:15 UTC --- Well, it's a tree optimization issue. It's simple - the local aggregate f escapes the function via the member function call to baz: <bb 5>: foo::baz (&f); and as our points-to analysis is not flow-sensitive for memory/calls this causes f to be clobbered by the call to bar: <bb 2>: f.b = 0; # USE = nonlocal null { f } # CLB = nonlocal null { f } retval.0_2 = bar (); as neither the bodies of baz nor bar are visible there is nothing we can do here (short of re-doing points-to analysis flow-sensitive for memory). f.b is partially redundant, so you see later jump-threading at work optimizing the path following the f.b = true assignment.