[llvm-bugs] [Bug 40959] New: Passing memory references to inline assembler does not accept 'c' modifier on ARM32

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Mar 4 13:35:43 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=40959

            Bug ID: 40959
           Summary: Passing memory references to inline assembler does not
                    accept 'c' modifier on ARM32
           Product: new-bugs
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: frank.mehnert at kernkonzept.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Consider the following example:

  static void foo()
  {
  }

  int main(void)
  {
    asm volatile (".pushsection \".data\"\n"
                  ".long %c[foo]\n"
                  ".popsection\n"
                  :
                  : [foo] "i" (&foo));
    return 0;
  }

The intention is to code the address of foo() into the data segment. This code
does not compile with

  clang-8 --target=arm-linux-gnueabi -O2 -o bar bar.c -fno-pic

but it successfully compiles if the 'c' modifier is omitted:

  asm volatile (".pushsection \".data\"\n"
                ".long %[foo]\n"
                ".popsection\n"

Same code on ARM64 compiles fine:

  asm volatile (".pushsection \".data\"\n"
                ".8byte %c[foo]\n"
                ".popsection\n"

I believe that specifying the 'c' modifier is correct. Gcc always demans on it
and does not compile without the 'c' modifier.

-- 
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/20190304/b59c8d1a/attachment-0001.html>


More information about the llvm-bugs mailing list