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: unassig...@gcc.gnu.org

        ReportedBy: akob...@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.

Reply via email to