<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - ARM asm fails with a compiler crash."
   href="https://llvm.org/bugs/show_bug.cgi?id=25317">25317</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ARM asm fails with a compiler crash.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rich@pennware.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15161" name="attach_15161" title="Shell script and .c file.">attachment 15161</a> <a href="attachment.cgi?id=15161&action=edit" title="Shell script and .c file.">[details]</a></span>
Shell script and .c file.

I'm trying to build Linux with clang and I ran in to a clang crash with the
following test code:
[~] dev% cat /tmp/bug-f5a092.c
# 1 "<built-in>"
# 1 "bug.c"

void crash_setup_regs()
{
  int i15, i16, i13, i14, i0;
  __asm__ __volatile__ (
   "stmia       %[regs_base], {r0-r12}\n\t"
   "mov %[_ARM_sp], sp\n\t"
   "str lr, %[_ARM_lr]\n\t"
   "adr %[_ARM_pc], 1f\n\t"
   "mrs %[_ARM_cpsr], cpsr\n\t"
  "1:"
   : [_ARM_pc] "=r" (i15),
     [_ARM_cpsr] "=r" (i16),
     [_ARM_sp] "=r" (i13),
     [_ARM_lr] "=o" (i14)
   : [regs_base] "r" (&i0)
   : "memory"
  );
}

The error is:
[~] dev% "/home/rich/llvm-dir/bin/clang" -target armv7-linux-gnueabihf -S bug.c
clang: /home/rich/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:6359:
void llvm::SelectionDAGBuilder::visitInlineAsm(llvm::ImmutableCallSite):
Assertion `ConstraintID != InlineAsm::Constraint_Unknown && "Failed to convert
memory constraint code to constraint id."' failed.
#0 0x30355c5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/rich/llvm-dir/bin/clang+0x30355c5)
#1 0x30346a6 llvm::sys::RunSignalHandlers()
(/home/rich/llvm-dir/bin/clang+0x30346a6)
#2 0x30348c4 (/home/rich/llvm-dir/bin/clang+0x30348c4)
#3 0x37bf6100d0 __restore_rt (/lib64/libpthread.so.0+0x37bf6100d0)
#4 0x37bea348d7 __GI_raise (/lib64/libc.so.6+0x37bea348d7)
#5 0x37bea3653a __GI_abort (/lib64/libc.so.6+0x37bea3653a)
#6 0x37bea2d47d __assert_fail_base (/lib64/libc.so.6+0x37bea2d47d)
#7 0x37bea2d532 (/lib64/libc.so.6+0x37bea2d532)
#8 0x25ddfc0 llvm::SelectionDAGBuilder::visitInlineAsm(llvm::ImmutableCallSite)
(/home/rich/llvm-dir/bin/clang+0x25ddfc0)
#9 0x25eca46 llvm::SelectionDAGBuilder::visitCall(llvm::CallInst const&)
(/home/rich/llvm-dir/bin/clang+0x25eca46)
#10 0x25eed2a llvm::SelectionDAGBuilder::visit(llvm::Instruction const&)
(/home/rich/llvm-dir/bin/clang+0x25eed2a)
#11 0x25fe658
llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction
const>, llvm::ilist_iterator<llvm::Instruction const>, bool&)
(/home/rich/llvm-dir/bin/clang+0x25fe658)
#12 0x2602277 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function
const&) (/home/rich/llvm-dir/bin/clang+0x2602277)
#13 0x2603e10
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/rich/llvm-dir/bin/clang+0x2603e10)
#14 0x2194274 (/home/rich/llvm-dir/bin/clang+0x2194274)
#15 0x2fa7ca3 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/rich/llvm-dir/bin/clang+0x2fa7ca3)
#16 0x2fa82eb llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/rich/llvm-dir/bin/clang+0x2fa82eb)
#17 0xc85ff3 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/home/rich/llvm-dir/bin/clang+0xc85ff3)
#18 0xc6578d (/home/rich/llvm-dir/bin/clang+0xc6578d)
#19 0xe9935d clang::ParseAST(clang::Sema&, bool, bool)
(/home/rich/llvm-dir/bin/clang+0xe9935d)
#20 0xc663fb clang::CodeGenAction::ExecuteAction()
(/home/rich/llvm-dir/bin/clang+0xc663fb)
#21 0xa7c086 clang::FrontendAction::Execute()
(/home/rich/llvm-dir/bin/clang+0xa7c086)
#22 0xa54f49 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/rich/llvm-dir/bin/clang+0xa54f49)
#23 0xa38f03 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/rich/llvm-dir/bin/clang+0xa38f03)
#24 0xa30248 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/home/rich/llvm-dir/bin/clang+0xa30248)
#25 0x9f06c3 main (/home/rich/llvm-dir/bin/clang+0x9f06c3)
#26 0x37bea1ffe0 __libc_start_main (/lib64/libc.so.6+0x37bea1ffe0)
#27 0xa2ece7 _start (/home/rich/llvm-dir/bin/clang+0xa2ece7)
Stack dump:
0.      Program arguments: /home/rich/llvm-dir/bin/clang -cc1 -triple
armv7--linux-gnueabihf -S -disable-free -main-file-name bug.c
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -target-cpu cortex-a8 -target-abi
aapcs-linux -mfloat-abi hard -target-linker-version 2.24 -dwarf-column-info
-coverage-file /home/rich/bug.c -resource-dir
/home/rich/llvm-dir/bin/../lib/clang/3.8.0 -internal-isystem /usr/local/include
-internal-isystem /home/rich/llvm-dir/bin/../lib/clang/3.8.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-fdebug-compilation-dir /home/rich -ferror-limit 19 -fmessage-length 81
-fallow-half-arguments-and-returns -fno-signed-char -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o bug.s -x c bug.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'bug.c'.
4.      Running pass 'ARM Instruction Selection' on function
'@crash_setup_regs'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (trunk 250619)
Target: armv7--linux-gnueabihf
Thread model: posix
InstalledDir: /home/rich/llvm-dir/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/bug-f5a092.c
clang: note: diagnostic msg: /tmp/bug-f5a092.sh
clang: note: diagnostic msg: 

********************
[~] dev%</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>