public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sugioka at itonet dot co dot jp" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/27182]  New: [4.1 regression] SH: wrong-code generation
Date: Mon, 17 Apr 2006 13:17:00 -0000	[thread overview]
Message-ID: <bug-27182-8402@http.gcc.gnu.org/bugzilla/> (raw)

Hi,
gcc-4.1.0 miscompiles on sh4-linux target.
Attached testcase does not trigger this bug on mainline,
and also correctly compiled with gcc-3.4.5.

For attached testcase, source line 514 is incorrectly compiled with
following command line.

g++ -O2 -g -fno-strict-aliasing -fwrapv \
   -fno-implicit-templates -fno-exceptions -fno-rtti -S -o bad.s sql_select4.ii

incorrect result:
        .loc 1 515 0
        mov.l   @(52,r14),r2
        .loc 1 514 0
        add     #12,r1
        .loc 1 515 0
        mov.l   r2,@-r1
        .loc 1 514 0
        mov     #0,r2
        mov.l   r2,@r1          <===== #0 is stored incorrect address
                                        ("add #4,r1" is needed bofore this
line)

Adding -fno-schedule-insns fixes this.
g++ -O2 -g -fno-schedule-insns -fno-strict-aliasing -fwrapv \
   -fno-implicit-templates -fno-exceptions -fno-rtti -S -o good.s
sql_select4.ii

correct result:
        mov     #0,r2
        .....
        fmov.s  fr6,@r1
        fmov.s  fr7,@-r1
        .loc 1 514 0
        add     #12,r1
        mov.l   r2,@r1
        .loc 1 515 0
        mov.l   @(52,r14),r7
        mov.l   r7,@-r1

On mainline, this problem disapeares after following patch.
2005-11-30  Paolo Bonzini  <bonzini@gnu.org>

        * simplify-rtx.c (simplify_plus_minus): Remove final parameter.
        Always produce an output if we can remove NEGs or canonicalize
        (minus (minus ...)) expressions.  Provide a fast path for the
        two-operand case.
        (simplify_gen_binary): Do not call simplify_plus_minus.
        (simplify_binary_operation_1): Reassociate at the end of the
        function.


-- 
           Summary: [4.1 regression] SH: wrong-code generation
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sugioka at itonet dot co dot jp
 GCC build triplet: sh4-unknown-linux
  GCC host triplet: sh4-unknown-linux
GCC target triplet: sh4-unknown-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27182


             reply	other threads:[~2006-04-17 13:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-17 13:17 sugioka at itonet dot co dot jp [this message]
2006-04-17 13:19 ` [Bug target/27182] " sugioka at itonet dot co dot jp
2006-04-19 12:42 ` kkojima at gcc dot gnu dot org
2006-04-19 19:35 ` amylaar at gcc dot gnu dot org
2006-04-19 22:41 ` kkojima at gcc dot gnu dot org
2006-04-20  1:54 ` kkojima at gcc dot gnu dot org
2006-04-20  2:04 ` kkojima at gcc dot gnu dot org
2006-06-04 19:47 ` jsm28 at gcc dot gnu dot 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-27182-8402@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).