[LLVMbugs] [Bug 22813] New: AARCH32 asm("b %0":: "i" (3)) should issues a warning
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Mar 5 13:36:38 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22813
Bug ID: 22813
Summary: AARCH32 asm("b %0":: "i" (3)) should issues a warning
Product: clang
Version: 3.6
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: axelheider at gmx.de
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
follow up from the comments at bug #22761. with LLVM/Clang 3.6 targeting
ARCH322 this compiles without warnings/errors:
__asm ("b %0":: "i" (0)); // 10000004: ea000000 b 1000000c (+0x08)
__asm ("b %0":: "i" (1)); // 10000008: ea000000 b 10000010 (+0x08)
__asm ("b %0":: "i" (2)); // 1000000c: ea000000 b 10000014 (+0x08)
__asm ("b %0":: "i" (3)); // 10000010: ea000000 b 10000018 (+0x08)
__asm ("b %0":: "i" (4)); // 10000014: ea000001 b 10000020 (+0x0C)
But it silently clears out the lower two bits if they are not zero. This should
actually give a warning. In ARM mode any constant must be a multiple of 4, in
TUMB mode it must be a multiple of 2. Anything else cannot even be encoded in
the instruction. So at least a warning here would be nice, like is is done
when targeting AARCH64 here
__asm ("b %0":: "i" (0)); // ok for any multiple of 4
__asm ("b %0":: "i" (1)); // error for any non-multiple of 4
error: expected label or encodable integer pc offset
__asm ("b %0":: "i" (1));
<inline asm>:1:4: note: instantiated into assembly here
b #1
--
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/20150305/8a2eef56/attachment.html>
More information about the llvm-bugs
mailing list