public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/27182]  New: [4.1 regression] SH: wrong-code generation
@ 2006-04-17 13:17 sugioka at itonet dot co dot jp
  2006-04-17 13:19 ` [Bug target/27182] " sugioka at itonet dot co dot jp
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: sugioka at itonet dot co dot jp @ 2006-04-17 13:17 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2006-06-04 19:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-17 13:17 [Bug target/27182] New: [4.1 regression] SH: wrong-code generation sugioka at itonet dot co dot jp
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

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).