public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/67573] New: [SH] wrong code generated for libstdc++-v3/src/c++11/cxx11-shim_facets.cc at -mlra
@ 2015-09-14 13:00 kkojima at gcc dot gnu.org
  2015-09-14 13:09 ` [Bug target/67573] " kkojima at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: kkojima at gcc dot gnu.org @ 2015-09-14 13:00 UTC (permalink / raw)
  To: gcc-bugs

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<wchar_t,
true>(std::integral_constant<bool, true>, std::locale::facet const*,
std::__moneypunct_cache<wchar_t, true>*)
at "-m4 -ml -O2 -fPIC -mlra -std=gnu++11".

It uses __copy<wchar_t> inline function and __copy<wchar_t> calls
std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >::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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-09-20 23:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14 13:00 [Bug target/67573] New: [SH] wrong code generated for libstdc++-v3/src/c++11/cxx11-shim_facets.cc at -mlra kkojima at gcc dot gnu.org
2015-09-14 13:09 ` [Bug target/67573] " kkojima at gcc dot gnu.org
2015-09-15 11:28 ` kkojima at gcc dot gnu.org
2015-09-15 14:13 ` kkojima at gcc dot gnu.org
2015-09-15 23:14 ` olegendo at gcc dot gnu.org
2015-09-17  0:13 ` kkojima at gcc dot gnu.org
2015-09-17  0:24 ` kkojima at gcc dot gnu.org
2015-09-17 14:28 ` olegendo at gcc dot gnu.org
2015-09-19 12:52 ` kkojima at gcc dot gnu.org
2015-09-20 23:54 ` kkojima at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).