[LLVMbugs] [Bug 20117] New: Clang's assembler doesn't ignore extraneous "#" characters in ARM inline assembly.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 24 09:11:46 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20117

            Bug ID: 20117
           Summary: Clang's assembler doesn't ignore extraneous "#"
                    characters in ARM inline assembly.
           Product: clang
           Version: unspecified
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jacob.bramley at arm.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

I'm using Clang as packaged by Ubuntu: Ubuntu clang version 3.5-1ubuntu1
(trunk) (based on LLVM 3.5)
This doesn't seem to agree with the available options in the 'version' field.

----

Consider the following test function:


int test(void) {
  int out;
  asm("  ldr %0, =%1\n" : "=r" (out) : "i" (0x000f0002));
  return out;
}


The instruction generated by the inline assembly is "ldr r0, =#983042", since
"i" constraints get a leading hash character by default. The GNU assembler
ignores this character, but Clang does not:


test.c:4:7: error: unknown token in expression
  asm("  ldr %0, =%1\n" : "=r" (out) : "i" (0x000f0002));
      ^
<inline asm>:1:13: note: instantiated into assembly here
          ldr r0, =#983042
                   ^
1 error generated.


GCC has an (undocumented) substitution predicate which causes the hash
character to be omitted ("ldr %0, =%c1"), and Clang appears to support this,
but this still represents an incompatibility with GCC and therefore might be
considered a bug.

-- 
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/20140624/c3411cfa/attachment.html>


More information about the llvm-bugs mailing list