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 target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax


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

             Bug #: 56114
           Summary: x86_64-linux-gnu-gcc generate wrong asm instruction
                    MOVABS for intel syntax
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: akobets@mail.ru


For example file l.c

long foo2 (void)
{
  return *(volatile long*)0xFEE00000;
}

x86_64-linux-gnu-gcc -c -save-temps l.c -O2 -masm=intel
cat l.s
    .file    "l.c"
    .intel_syntax noprefix
    .text
    .p2align 4,,15
    .globl    foo2
    .type    foo2, @function
foo2:
.LFB0:
    .cfi_startproc
    movabs    rax, 4276092928
    ret

This is erroneous instruction, because movabs rax, 4276092928 loads immediate
data. This code must be
movabs    rax, [4276092928]
with square brackets.

When we try to read 32-bit data from memory, then we get error message
long foo2 (void)
{
  return *(volatile int*)0xFEE00000;
}
x86_64-linux-gnu-gcc -c -save-temps l.c -O2 -masm=intel
cat l.s
    .file    "l.c"
    .intel_syntax noprefix
    .text
    .p2align 4,,15
    .globl    foo2
    .type    foo2, @function
foo2:
.LFB0:
    .cfi_startproc
    movabs    eax, 4276092928
    cdqe
    ret

Because movabs allows load 64-bit only immediate data. Here is GCC loose square
brackets.


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