public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax
@ 2013-01-25 22:48 akobets at mail dot ru
  2013-01-25 23:07 ` [Bug target/56114] " akobets at mail dot ru
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: akobets at mail dot ru @ 2013-01-25 22:48 UTC (permalink / raw)
  To: gcc-bugs


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.


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

end of thread, other threads:[~2013-01-27 20:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-25 22:48 [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax akobets at mail dot ru
2013-01-25 23:07 ` [Bug target/56114] " akobets at mail dot ru
2013-01-26  9:21 ` ubizjak at gmail dot com
2013-01-26 14:31 ` akobets at mail dot ru
2013-01-26 15:08 ` ubizjak at gmail dot com
2013-01-26 16:55 ` akobets at mail dot ru
2013-01-27 13:17 ` uros at gcc dot gnu.org
2013-01-27 16:04 ` uros at gcc dot gnu.org
2013-01-27 18:37 ` uros at gcc dot gnu.org
2013-01-27 18:46 ` ubizjak at gmail dot com
2013-01-27 20:49 ` akobets at mail dot ru

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