public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/31768]  New: Invalid code or ICE for %z constraint
@ 2007-04-30 22:03 us15 at os dot inf dot tu-dresden dot de
  2007-05-03 14:32 ` [Bug inline-asm/31768] " uros at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: us15 at os dot inf dot tu-dresden dot de @ 2007-04-30 22:03 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug inline-asm/31768] Invalid code or ICE for %z constraint
  2007-04-30 22:03 [Bug inline-asm/31768] New: Invalid code or ICE for %z constraint us15 at os dot inf dot tu-dresden dot de
@ 2007-05-03 14:32 ` uros at gcc dot gnu dot org
  2007-05-03 14:41 ` [Bug target/31768] " ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: uros at gcc dot gnu dot org @ 2007-05-03 14:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from uros at gcc dot gnu dot org  2007-05-03 15:32 -------
Subject: Bug 31768

Author: uros
Date: Thu May  3 14:32:25 2007
New Revision: 124379

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124379
Log:
        PR target/31768
        * config/i386/i386.c (print_operand) ['z']: Output 'w' for
        operands of size 2 when operand is not MEM_P.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.c


-- 


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


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

* [Bug target/31768] Invalid code or ICE for %z constraint
  2007-04-30 22:03 [Bug inline-asm/31768] New: Invalid code or ICE for %z constraint us15 at os dot inf dot tu-dresden dot de
  2007-05-03 14:32 ` [Bug inline-asm/31768] " uros at gcc dot gnu dot org
@ 2007-05-03 14:41 ` 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
  3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2007-05-03 14:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ubizjak at gmail dot com  2007-05-03 15:41 -------
(In reply to comment #0)

>     unsigned long c;

Fixed in mainline. But don't use long types on "out" insn, as you will generate
"outll" on x86_64.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|inline-asm                  |target
      Known to fail|                            |4.1.2 4.2.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


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


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

* [Bug target/31768] Invalid code or ICE for %z constraint
  2007-04-30 22:03 [Bug inline-asm/31768] New: Invalid code or ICE for %z constraint us15 at os dot inf dot tu-dresden dot de
  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
  3 siblings, 0 replies; 5+ messages in thread
From: us15 at os dot inf dot tu-dresden dot de @ 2007-05-03 15:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from us15 at os dot inf dot tu-dresden dot de  2007-05-03 16:22 -------
Is there any chance of this problem being fixed in 4.1 and 4.2 as well? If so,
should I open new bugs for those?


-- 


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


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

* [Bug target/31768] Invalid code or ICE for %z constraint
  2007-04-30 22:03 [Bug inline-asm/31768] New: Invalid code or ICE for %z constraint us15 at os dot inf dot tu-dresden dot de
                   ` (2 preceding siblings ...)
  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
  3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2007-05-03 16:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ubizjak at gmail dot com  2007-05-03 17:38 -------
(In reply to comment #3)
> Is there any chance of this problem being fixed in 4.1 and 4.2 as well? If so,
> should I open new bugs for those?

The %z modifier is IMO not intended for general use, so I don't think the
backport will be done. However, you could just use

out (unsigned port, T val)
{
    asm volatile ("out %0, %w1" : : "a" (val), "Nd" (port));
}

(i.e. "out" insn without any decorations), and correct code will be generated.
At least recent binutils will handle all cases, including unsigned long on
x86_64.


-- 


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


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

end of thread, other threads:[~2007-05-03 16:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-30 22:03 [Bug inline-asm/31768] New: Invalid code or ICE for %z constraint us15 at os dot inf dot tu-dresden dot de
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

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