http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57372
Bug ID: 57372 Summary: [4.9 Regression] Miscompiled tailcall on ARM Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zhroma at ispras dot ru Created attachment 30164 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30164&action=edit Preprocessed minimized testcase On ARM, gcc 4.9 revision 198928 and later sometimes creates wrong code for tailcall. For C++ code: class A { public: virtual void foo1(); }; A& foo2() {} void foo3() { foo2().foo1(); } In function foo3 last instruction is "bx r3", but register r3 doesn't contain a proper address at that moment. Attachment contains practically the same code, it was adjusted to create an executable, and executable produced by "g++ -O2" segfaults. Earlier versions of GCC works ok.