From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40651 invoked by alias); 14 Sep 2015 13:00:22 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 40514 invoked by uid 48); 14 Sep 2015 13:00:17 -0000 From: "kkojima at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/67573] New: [SH] wrong code generated for libstdc++-v3/src/c++11/cxx11-shim_facets.cc at -mlra Date: Mon, 14 Sep 2015 13:00:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kkojima at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc blocked target_milestone cf_gcctarget Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-09/txt/msg01158.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67573 Bug ID: 67573 Summary: [SH] wrong code generated for libstdc++-v3/src/c++11/cxx11-shim_facets.cc at -mlra Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: kkojima at gcc dot gnu.org CC: olegendo at gcc dot gnu.org Blocks: 55212 Target Milestone: --- Target: sh*-*-* Wrong code is generated with sh-linux/sh-elf compilers for void std::__facet_shims::__moneypunct_fill_cache(std::integral_constant, std::locale::facet const*, std::__moneypunct_cache*) at "-m4 -ml -O2 -fPIC -mlra -std=gnu++11". It uses __copy inline function and __copy calls std::__cxx11::basic_string, std::allocator >::copy(wchar_t*, unsigned int, unsigned int) with the wrong code mov r11,r4 mov.l .L1122,r7 mov r0,r5 mov.l @r15,r6 mov r10,r4 bsrf r7 .LPCS203: mov.l r0,@(4,r15) ... .L1122: .long _ZNKSt7__cxx1112basic_stringIwSt11char_traitsIwESaIwEE4copyEPwjj@PLT-(.LPCS203+2-.) where r7 should be 0 as the last argument. With -mno-lra, the corresponding code is: mov.l .L1050,r1 mov r0,r14 mov #0,r7 mov r13,r6 mov r0,r5 bsrf r1 .LPCS191: mov r10,r4 ... It seems that dse/dce removes mov #0, r7. .pro_and_epilogue: (insn 204 831 830 22 (set (reg:SI 7 r7) (const_int 0 [0])) fa.cc:484 253 {movsi_ie} (nil)) .dse2 marks r7 unused: (insn 204 831 830 22 (set (reg:SI 7 r7) (const_int 0 [0])) fa.cc:484 253 {movsi_ie} (expr_list:REG_UNUSED (reg:SI 7 r7) (nil))) .jump2 eliminates insn 204: DCE: Deleting insn 204 deleting insn with uid = 204. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55212 [Bug 55212] [SH] Switch to LRA