[llvm-bugs] [Bug 33654] New: x86 assembler immediates should be limited to 32 bit
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jun 30 05:25:15 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=33654
Bug ID: 33654
Summary: x86 assembler immediates should be limited to 32 bit
Product: new-bugs
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: dimitry at andric.com
CC: llvm-bugs at lists.llvm.org
In bug 33386, Jonas Vekeman encountered a situation where OpenSSL's inline
assembly in combination with function inlining could sometimes lead to errors
from the inline asm parser, e.g.:
<inline asm>:1:12: error: invalid operand for instruction
divq $-8446744073709551616
^~~~~~~~~~~~~~~~~~~~~
LLVM ERROR: Error parsing inline asm
For this particular case, I created a test.s file with just:
divq 0x7fffffff
divq 0x80000000
divq 0xffffffff
divq 0x100000000
divq 0xffffffffffffffff
For this assembly, GNU as rightfully complains about lines 2 through 4:
divtest.s: Assembler messages:
divtest.s:2: Error: operand type mismatch for `div'
divtest.s:3: Error: operand type mismatch for `div'
divtest.s:4: Error: operand type mismatch for `div'
However, clang 5.0.0 doesn't complain at all, and produces an object file.
Disassembling it shows that clang has silently wrapped the too-large values:
0: 48 f7 34 25 ff ff ff 7f divq 2147483647
8: 48 f7 34 25 00 00 00 80 divq -2147483648
10: 48 f7 34 25 ff ff ff ff divq -1
18: 48 f7 34 25 00 00 00 00 divq 0
20: 48 f7 34 25 ff ff ff ff divq -1
At the very least, it should complain here like GNU as does, IMHO.
--
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/20170630/08558811/attachment.html>
More information about the llvm-bugs
mailing list