From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32438 invoked by alias); 25 Jan 2013 22:48:16 -0000 Received: (qmail 32270 invoked by uid 48); 25 Jan 2013 22:47:41 -0000 From: "akobets at mail dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/56114] New: x86_64-linux-gnu-gcc generate wrong asm instruction MOVABS for intel syntax Date: Fri, 25 Jan 2013 22:48:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: akobets at mail dot ru X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg02410.txt.bz2 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.