The code inserted by output_function_profiler clobbers the lr register, causing the function to jump back to the beginning of the function when it returns.
.globl hello .type hello, @function hello: mflr 0 stw 0,4(1) bl _mcount stwu 1,-16(1) mflr 0 <-- lr already clobbered by bl stw 31,12(1) stw 0,20(1) -- Summary: Profiler call clobbers lr Product: gcc Version: 4.1.2 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: schwab at suse dot de GCC target triplet: powerpc-*-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28702