This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/20328] New: assembly constraints fail unless optimizing code


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]