https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81641

            Bug ID: 81641
           Summary: Assemble failure with named address spaces and
                    -masm=intel
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ubizjak at gmail dot com
  Target Milestone: ---

Using -O -masm=intel following testcase (gcc.target/i386/addr-space-2.c):

--cut here--
int test(void)
{
  int __seg_fs *f = (int __seg_fs *)16;
  int __seg_gs *g = (int __seg_gs *)16;
  return *f + *g;
}
--cut here--

compiles to:

        mov     eax, DWORD PTR gs:ds:16
        add     eax, DWORD PTR fs:ds:16
        ret

Fortunately (?) gas doesn't error out on this assembly and generates correct
object file:

0000000000000000 <test>:
   0:   65 8b 04 25 10 00 00    mov    %gs:0x10,%eax
   7:   00 
   8:   64 03 04 25 10 00 00    add    %fs:0x10,%eax
   f:   00 
  10:   c3                      retq

Reply via email to