http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59690
Bug ID: 59690 Summary: GCC fails to fold operations on frame-allocated variable across function call Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: patrick at parcs dot ath.cx In the following testcase void bar (void); void baz (int *); void foo (void) { int x; x = 5; bar (); x += 10; baz (&x); x += 15; bar (); x += 20; baz (&x); } GCC does not transform the sequence { x = 5; bar (); x += 10; ... } into { x = 15; bar (); ... }. It seems to think that the frame-allocated "x" is global memory.