public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "thutt at vmware dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/16331] x86-64 inline asm register constraints insufficient WRT ABI
Date: Tue, 06 Jul 2004 14:55:00 -0000	[thread overview]
Message-ID: <20040706145534.7463.qmail@sourceware.org> (raw)
In-Reply-To: <20040702165134.16331.thutt@vmware.com>


------- Additional Comments From thutt at vmware dot com  2004-07-06 14:55 -------
Could you reference the documentation defect number?

And, I'm not sure that just the documentation is wrong; consider:

extern int hokus(void);

void test(void)
{
    register int r8 asm("r8") = hokus();
    register int r9 asm("r9") = 6;
    
    __asm__ __volatile__("call pokus"
                         :
                         :
                         "D" (r8),
                         "S" (2),
                         "d" (3),
                         "c" (4),
                         "r" (r8),
                         "r" (r9)
                         );
    r8 = hokus();
    pokus(r8, 2, 3, 4, 5, 6);
}
0000000000000000 <test>:
   0:   55                      push   %rbp
   1:   48 89 e5                mov    %rsp,%rbp
   4:   e8 00 00 00 00          callq  9 <test+0x9>
                        5: R_X86_64_PC32        hokus+0xfffffffffffffffc
   9:   41 b9 06 00 00 00       mov    $0x6,%r9d
   f:   41 b8 05 00 00 00       mov    $0x5,%r8d
  15:   b9 04 00 00 00          mov    $0x4,%ecx
  1a:   ba 03 00 00 00          mov    $0x3,%edx
  1f:   be 02 00 00 00          mov    $0x2,%esi
  24:   44 89 c7                mov    %r8d,%edi
  27:   b8 00 00 00 00          mov    $0x0,%eax
  2c:   e8 00 00 00 00          callq  31 <test+0x31>
                        2d: R_X86_64_PC32       pokus+0xfffffffffffffffc
  31:   be 02 00 00 00          mov    $0x2,%esi
  36:   ba 03 00 00 00          mov    $0x3,%edx
  3b:   b9 04 00 00 00          mov    $0x4,%ecx
  40:   44 89 c7                mov    %r8d,%edi
  43:   e8 00 00 00 00          callq  48 <test+0x48>
                        44: R_X86_64_PC32       pokus+0xfffffffffffffffc
  48:   c9                      leaveq 
  49:   c3                      retq   

The first call of pokus() completely ignores the assigned value of the variable
r8 -- instead the value '6' into it for the call.  The second call assumes the
the register r8 should be used for the call, but by now the wrong value has bee
placed into it.

Perhaps the documentation is wrong, but so is the code generated.  I'm reopening.




-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


  parent reply	other threads:[~2004-07-06 14:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-02 16:51 [Bug c/16331] New: " thutt at vmware dot com
2004-07-02 16:57 ` [Bug c/16331] " falk at debian dot org
2004-07-02 18:49 ` thutt at vmware dot com
2004-07-02 18:54 ` pinskia at gcc dot gnu dot org
2004-07-06 14:55 ` thutt at vmware dot com [this message]
2004-08-03  7:06 ` [Bug target/16331] " pinskia at gcc dot gnu dot org
2005-07-02  1:27 ` pinskia at gcc dot gnu dot org
2005-07-02 10:17 ` falk at debian dot org
2005-09-04 19:05 ` pinskia 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=20040706145534.7463.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).