public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "drow at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/21223] New: Output register variable is reloaded into the wrong register for asm
Date: Mon, 25 Apr 2005 20:49:00 -0000	[thread overview]
Message-ID: <20050425204925.21223.drow@gcc.gnu.org> (raw)

Compile this test with an ARM-targeted compiler.  Using -O2, it works out OK;
but for -O0 or -O1 it doesn't.  I originally encountered the bug in -O2 compiled
code, but a more complex testcase is probably necessary for that.

int bar(int *mem)
{
  return ({ register int a_oldval asm ("r0");
            register int a_tmp asm ("r3");
            int a_oldval2 = 3;
            __asm__ __volatile__ ("# Should be r0 - %0\n\t"
                                  "# Should be r3 - %1"
                                  : "=&r" (a_oldval), "=&r" (a_tmp)
                                  : "r" (a_oldval2));
            a_tmp; });
}

Everything is OK up until reload.  Then this happens:

Spilling for insn 19.
Using reg 2 for reload 0
Spilling for insn 19.
Using reg 2 for reload 0

Reloads for insn # 19
Reload 0: reload_out (SI) = (reg/v:SI 3 r3 [ a_tmp ])
        GENERAL_REGS, RELOAD_OTHER (opnum = 1)
        reload_out_reg: (reg/v:SI 3 r3 [ a_tmp ])
        reload_reg_rtx: (reg:SI 2 r2)

and the set of a_tmp is replaced by a set of r2.  I can't figure out why
the reload was created.

-- 
           Summary: Output register variable is reloaded into the wrong
                    register for asm
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: drow at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: arm-none-linux-gnueabi


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


             reply	other threads:[~2005-04-25 20:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-25 20:49 drow at gcc dot gnu dot org [this message]
2005-04-25 20:54 ` [Bug rtl-optimization/21223] " pinskia at gcc dot gnu dot org
2005-04-25 21:08 ` drow at gcc dot gnu dot org
2005-04-25 21:10 ` [Bug middle-end/21223] " pinskia at gcc dot gnu dot org
2005-04-25 21:13 ` drow 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=20050425204925.21223.drow@gcc.gnu.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).