http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55667
Bug #: 55667 Summary: [regression] -O1 enables frame pointer push to move around on x86_64 Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: dfla...@nist.gov Target: x86_64-intel-linux-gnu Created attachment 28939 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28939 preprocessed test program On x86_64 linux, with -fno-omit-frame-pointer and -O1, gcc 4.7.x (verified for 4.7.0 and 4.7.2) allow the frame pointer (rbp) push instruction to wander away from the beginning of a function. As a result, profiling tools including perf and OProfile determine incorrect call chains, and subsequent calculations of call graphs and total time are wrong. The problem does not occur if any of the following are true: -O0 instead of -O1 -m32 instead of -m64 gcc 4.6.3 instead of 4.7.x The preprocessed source of a small program to demonstrate the problem is attached. Example output from the profiling tools and various versions of gcc, as well as the original small program, was sent to the oprofile-list at 2012-12-12 13:45 EST, but the list archive is presently unreachable, so email me for a copy if needed.