public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "us15 at os dot inf dot tu-dresden dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug inline-asm/31768]  New: Invalid code or ICE for %z constraint
Date: Mon, 30 Apr 2007 22:03:00 -0000	[thread overview]
Message-ID: <bug-31768-8549@http.gcc.gnu.org/bugzilla/> (raw)

The following code should generate outb, outw and outl statements.

gcc-3.4.6 produces an ICE:
foo.cc: In function `void out(unsigned int, T) [with T = unsigned char]':
foo.cc:14:   instantiated from here
foo.cc:5: internal compiler error: in print_operand, at config/i386/i386.c:7375

gcc-4.1.2 produces an ICE:
foo.cc: In function 'void out(unsigned int, T) [with T = unsigned char]':
foo.cc:5: internal compiler error: in print_operand, at config/i386/i386.c:7226

gcc-4.3.0 generates wrong code (outs instead of outw) for T=unsigned short 
foo.cc: Assembler messages:
foo.cc:5: Error: suffix or operands invalid for `outs'

Code snippet:

template <typename T>
static inline void
out (unsigned port, T val)
{
    asm volatile ("out%z0 %0, %w1" : : "a" (val), "Nd" (port));
}

int main()
{
    unsigned char a; 
    unsigned short b;
    unsigned long c;

    out (0x80, a);
    out (0x80, b);
    out (0x80, c);
}


-- 
           Summary: Invalid code or ICE for %z constraint
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: us15 at os dot inf dot tu-dresden dot de


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


             reply	other threads:[~2007-04-30 22:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-30 22:03 us15 at os dot inf dot tu-dresden dot de [this message]
2007-05-03 14:32 ` [Bug inline-asm/31768] " uros at gcc dot gnu dot org
2007-05-03 14:41 ` [Bug target/31768] " ubizjak at gmail dot com
2007-05-03 15:22 ` us15 at os dot inf dot tu-dresden dot de
2007-05-03 16:38 ` ubizjak at gmail dot com

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-31768-8549@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).