public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/20328] New: assembly constraints fail unless optimizing code
@ 2005-03-05  1:19 mrd at alkemio dot org
  2005-03-05  1:26 ` [Bug c/20328] " giovannibajo at libero dot it
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mrd at alkemio dot org @ 2005-03-05  1:19 UTC (permalink / raw)
  To: gcc-bugs

The following code (taken from L4Ka::Pistachio) compiles correctly on gcc
(3.3.4, 3.3.5, and 3.4.4) when given any optimization level, but fails when you
don't use any:

$ cat foo.c
unsigned char
inb (unsigned long port)
{
  unsigned char tmp;

  if (port < 0x100)
    __asm__ __volatile__ ("inb %w1, %0":"=al" (tmp):"dN" (port));
  else
    __asm__ __volatile__ ("inb %%dx, %0": "=al" (tmp):"d" (port));

  return tmp;
}
$ gcc -c foo.c
foo.c: In function `inb':
foo.c:7: error: impossible constraint in `asm'
foo.c:9: error: impossible constraint in `asm'
$ gcc -c foo.c -O
$

-- 
           Summary: assembly constraints fail unless optimizing code
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mrd at alkemio dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c/20328] assembly constraints fail unless optimizing code
  2005-03-05  1:19 [Bug c/20328] New: assembly constraints fail unless optimizing code mrd at alkemio dot org
@ 2005-03-05  1:26 ` giovannibajo at libero dot it
  2005-03-05  1:31 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: giovannibajo at libero dot it @ 2005-03-05  1:26 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2005-03-05 01:26 -------
Which target triplet?

-- 


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


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

* [Bug c/20328] assembly constraints fail unless optimizing code
  2005-03-05  1:19 [Bug c/20328] New: assembly constraints fail unless optimizing code mrd at alkemio dot org
  2005-03-05  1:26 ` [Bug c/20328] " giovannibajo at libero dot it
@ 2005-03-05  1:31 ` pinskia at gcc dot gnu dot org
  2005-03-05  6:44 ` mrd at alkemio dot org
  2005-03-05  6:52 ` mrd at alkemio dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-05  1:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-05 01:31 -------
You don't want the "al" contstraint at all.

Read the docs to figure out which constaint you really want.  the constraint "al" means pick either the 
"a" constraint or the "l" constraint

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


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


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

* [Bug c/20328] assembly constraints fail unless optimizing code
  2005-03-05  1:19 [Bug c/20328] New: assembly constraints fail unless optimizing code mrd at alkemio dot org
  2005-03-05  1:26 ` [Bug c/20328] " giovannibajo at libero dot it
  2005-03-05  1:31 ` pinskia at gcc dot gnu dot org
@ 2005-03-05  6:44 ` mrd at alkemio dot org
  2005-03-05  6:52 ` mrd at alkemio dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mrd at alkemio dot org @ 2005-03-05  6:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mrd at alkemio dot org  2005-03-05 06:44 -------
Subject: Re:  assembly constraints fail unless optimizing code

On Sat, 2005-03-05 at 01:26 +0000, giovannibajo at libero dot it wrote:
> Which target triplet?

i386-pc-linux-gnu



-- 


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


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

* [Bug c/20328] assembly constraints fail unless optimizing code
  2005-03-05  1:19 [Bug c/20328] New: assembly constraints fail unless optimizing code mrd at alkemio dot org
                   ` (2 preceding siblings ...)
  2005-03-05  6:44 ` mrd at alkemio dot org
@ 2005-03-05  6:52 ` mrd at alkemio dot org
  3 siblings, 0 replies; 5+ messages in thread
From: mrd at alkemio dot org @ 2005-03-05  6:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mrd at alkemio dot org  2005-03-05 06:52 -------
Subject: Re:  assembly constraints fail unless optimizing code

On Sat, 2005-03-05 at 01:31 +0000, pinskia at gcc dot gnu dot org wrote:
> You don't want the "al" contstraint at all.
> 
> Read the docs to figure out which constaint you really want.  the constraint "al" means pick either the 
> "a" constraint or the "l" constraint

The original code's not mine at all, so I don't know what constraint is
actually wanted.  However, after looking through section 5.36 of the gcc
3.4.3 manual, I can't figure out what the "l" constraint means for the
i386 architecture anyways.

So maybe the original code *shouldn't* be using the "=al" constraint,
but either the manual's missing a description of the "l" constraint for
i386 so I can't decide whether it's correct or not, or gcc's not
complaining about an illegal constraint when optimizations are enabled
(or maybe that's an optimization feature?).



-- 


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


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

end of thread, other threads:[~2005-03-05  6:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-05  1:19 [Bug c/20328] New: assembly constraints fail unless optimizing code mrd at alkemio dot org
2005-03-05  1:26 ` [Bug c/20328] " giovannibajo at libero dot it
2005-03-05  1:31 ` pinskia at gcc dot gnu dot org
2005-03-05  6:44 ` mrd at alkemio dot org
2005-03-05  6:52 ` mrd at alkemio dot org

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