public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kkojima at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-67573-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2015-09-14 13:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14 13:00 kkojima at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-67573-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).