public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/25603] [4.1/4.2 Regression]: Miscompiled FORTRAN program
Date: Mon, 02 Jan 2006 13:57:00 -0000	[thread overview]
Message-ID: <20060102135712.26788.qmail@sourceware.org> (raw)
In-Reply-To: <bug-25603-682@http.gcc.gnu.org/bugzilla/>



------- Comment #3 from jakub at gcc dot gnu dot org  2006-01-02 13:57 -------
This seems to be a reload bug, but Alan Modra's patch is correct.
In *.lreg we have:
(insn 577 78 11 2 (set (reg/f:DI 391)
        (reg/f:DI 0 ap)) 5 {*movdi_internal} (nil)
    (nil))

(insn 11 577 14 2 (set (reg/v/f:DI 388 [ nfilt ])
        (mem/c/i:DI (post_inc:DI (reg/f:DI 391)) [0 nfilt+0 S8 A64])) 5
{*movdi_internal} (insn_list:REG_DEP_TRUE 577 (nil))
    (expr_list:REG_INC (reg/f:DI 391)
        (expr_list:REG_EQUIV (mem/f/c/i:DI (reg/f:DI 0 ap) [0 nfilt+0 S8 A64])
            (nil))))

(insn 14 11 83 2 (set (reg/v/f:DI 389 [ xstart ])
        (mem/c/i:DI (reg/f:DI 391) [0 xstart+0 S8 A64])) 5 {*movdi_internal}
(insn_list:REG_DEP_TRUE 11 (insn_list:REG_DEP_TRUE
577 (nil)))
    (expr_list:REG_DEAD (reg/f:DI 391)
        (expr_list:REG_EQUIV (mem/f/c/i:DI (plus:DI (reg/f:DI 0 ap)
                    (const_int 8 [0x8])) [0 xstart+0 S8 A64])
            (nil))))

ap is in this case r12 + 1088, and the difference coming from Alan Modra's
patch is that before insn 577 was reloaded to an identical insn (as its
INSN_CODE
was wrong), while with that fix the insn is kept as is.  The only real effect
of the reloading resp. not reloading in insn 577 is register choice for
reloading
of subsequent insn,
(insn 11 577 14 2 (set (mem/c/i:DI (plus:DI (reg/f:DI 12 r12)
                (const_int 1088 [0x440])) [0 nfilt+0 S8 A64])
        (mem/c/i:DI (post_inc:DI (reg/f:DI 14 r14 [391])) [0 nfilt+0 S8 A64]))
5 {*movdi_internal} (insn_list:REG_DEP_TRUE 577 (nil))
    (expr_list:REG_INC (reg/f:DI 14 r14 [391])
        (expr_list:REG_EQUIV (mem/f/c/i:DI (reg/f:DI 0 ap) [0 nfilt+0 S8 A64])
            (nil))))

In one case, choose_reload_regs picks up:
Reload 0: reload_in (DI) = (plus:DI (reg/f:DI 12 r12)
                                                    (const_int 1088 [0x440]))
        GR_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 0), can't combine
        reload_in_reg: (plus:DI (reg/f:DI 12 r12)
                                                    (const_int 1088 [0x440]))
        reload_reg_rtx: (reg/f:DI 14 r14 [391])
Reload 1: reload_out (DI) = (mem/c/i:DI (plus:DI (reg/f:DI 12 r12)
                                                        (const_int 1088
[0x440])) [0 nfilt+0 S8 A64])
        NO_REGS, RELOAD_FOR_OUTPUT (opnum = 0), optional
        reload_out_reg: (reg/v/f:DI 388 [ nfilt ])
Reload 2: reload_in (DI) = (mem/c/i:DI (post_inc:DI (reg/f:DI 14 r14 [391])) [0
nfilt+0 S8 A64])
        GR_REGS, RELOAD_FOR_INPUT (opnum = 1)
        reload_in_reg: (mem/c/i:DI (post_inc:DI (reg/f:DI 14 r14 [391])) [0
nfilt+0 S8 A64])
        reload_reg_rtx: (reg:DI 15 r15)
and with Alan's patch reverted it chooses reload_reg_rtx for reload 0 and 2
r15 and r16 instead.  It seems reload is confused by the POST_INC and when
it chooses r14 is rld[0].reg_rtx, we get:
(insn 611 577 610 2 (set (reg:DI 15 r15)
        (mem/c/i:DI (post_inc:DI (reg/f:DI 14 r14 [391])) [0 nfilt+0 S8 A64]))
5 {*movdi_internal} (nil)
    (expr_list:REG_INC (reg/f:DI 14 r14 [391])
        (nil)))

(insn 610 611 11 2 (set (reg/f:DI 14 r14 [391])
        (plus:DI (reg/f:DI 12 r12)
            (const_int 1088 [0x440]))) 105 {adddi3} (nil)
    (nil))

(insn 11 610 14 2 (set (mem/c/i:DI (reg/f:DI 14 r14 [391]) [0 nfilt+0 S8 A64])
        (reg:DI 15 r15)) 5 {*movdi_internal} (insn_list:REG_DEP_TRUE 577 (nil))
    (expr_list:REG_EQUIV (mem/f/c/i:DI (reg/f:DI 0 ap) [0 nfilt+0 S8 A64])
        (nil)))

(insn 14 11 83 2 (set (reg/v/f:DI 107 loc75 [orig:389 xstart ] [389])
        (mem/c/i:DI (reg/f:DI 14 r14 [391]) [0 xstart+0 S8 A64])) 5
{*movdi_internal} (insn_list:REG_DEP_TRUE 11 (insn_list:REG_DEP_TRUE 577
(nil)))
    (expr_list:REG_EQUIV (mem/f/c/i:DI (plus:DI (reg/f:DI 0 ap)
                (const_int 8 [0x8])) [0 xstart+0 S8 A64])
        (nil)))
which is wrong, as r14 should have contained r12 + 1088 + 8 in insn 14, not
r12 + 1088.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-01-02 13:57:12
               date|                            |


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



  parent reply	other threads:[~2006-01-02 13:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-30 17:35 [Bug target/25603] New: " hjl at lucon dot org
2005-12-30 17:40 ` [Bug target/25603] " hjl at lucon dot org
2005-12-30 17:53 ` pinskia at gcc dot gnu dot org
2005-12-30 18:42 ` hjl at lucon dot org
2006-01-02 13:57 ` jakub at gcc dot gnu dot org [this message]
2006-01-09 22:03 ` steven at gcc dot gnu dot org
2006-01-10 22:07 ` steven at gcc dot gnu dot org
2006-01-23 16:58 ` sje at cup dot hp dot com
2006-01-31  3:49 ` wilson at gcc dot gnu dot org
2006-02-08  6:40 ` grigory_zagorodnev at linux dot intel dot com
2006-02-10  2:03 ` wilson at gcc dot gnu dot org
2006-02-10  3:37 ` hjl at lucon dot org
2006-02-14 18:56 ` amylaar at gcc dot gnu dot org
2006-02-14 19:33 ` hjl at lucon dot org
2006-02-14 20:04 ` hjl at lucon dot org
2006-02-14 21:15 ` pinskia at gcc dot gnu dot org
2006-02-15 21:29 ` hjl at lucon dot org
2006-02-17  0:03 ` hjl at gcc dot gnu dot org
2006-02-20 17:46 ` [Bug target/25603] [4.1 " hjl at lucon dot org
2006-02-22 16:30 ` rguenth at gcc dot gnu dot org
2006-02-22 16:59 ` hjl at gcc dot gnu dot org
2006-02-22 17:04 ` hjl at lucon dot org
2006-02-22 22:51 ` mmitchel at gcc dot gnu dot org
2006-02-24  1:20 ` mmitchel at gcc dot gnu dot org
2006-02-24  1:37 ` mmitchel 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=20060102135712.26788.qmail@sourceware.org \
    --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).