[llvm-bugs] [Bug 34617] New: [X86] [ASM INTEL SYNTAX] clang generates incorrect assembler code when x86-asm-syntax=intel
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Sep 14 18:58:00 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34617
Bug ID: 34617
Summary: [X86] [ASM INTEL SYNTAX] clang generates incorrect
assembler code when x86-asm-syntax=intel
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: konstantin.belochapka at sony.com
CC: llvm-bugs at lists.llvm.org
Consider the following source code:
-----------------------------------------------------------------
char X[ 4 ];
extern char testCall084(long n, char* y);
volatile char* px;
char test084(long x0) {
char rc = testCall084(x0, X);
px = X;
return rc;
}
Running:
$clang -S -O1 -mllvm --x86-asm-syntax=intel source.cpp
Produces the following assembler source:
--------------------------------------------------------------
_Z7test084l:
push rax
mov esi, X
call _Z11testCall084lPc
mov qword ptr [rip + px], X
pop rcx
ret
GNU assembler interprets:
1 mov esi, X
2 mov qword ptr [rip + px], X
as:
1 mov esi, [X]
2 mov qword ptr [rip + px], [X]
which produces incorrect binary code for first instruction
and error message:
"too many memory references for `mov'" for second instruction.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170915/7023d62f/attachment.html>
More information about the llvm-bugs
mailing list