[llvm-bugs] [Bug 38718] New: Inline assembly referencing a local goto label without any labels given crashes LLVM

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Aug 27 03:00:29 PDT 2018


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

            Bug ID: 38718
           Summary: Inline assembly referencing a local goto label without
                    any labels given crashes LLVM
           Product: libraries
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: emil.gedda at emilgedda.se
                CC: llvm-bugs at lists.llvm.org

Created attachment 20776
  --> https://bugs.llvm.org/attachment.cgi?id=20776&action=edit
crashing example

Trying to use "outs %l0 %w1" in inline assembly crashes LLVM.
The culprit in this case is the "%l0" which references a goto label when none
was given.

How to reproduce: 
   See below

Expected behaviour:
   An error explaining that you cant reference labels using "%l" without the
goto qualifier on the inline assembly,
   and if possible tell the user "did you forget the goto qualifier?" (even
though goto qualifiers are not supported yet).

Actual behaviour:
   Compiling with clang++ and without optimizations segfaults LLVM, with
optimizations it crashes with out of memory.
   Compiling directly with llc gives "No such file or directory", and then
segfaults.

Repro:

 $ cat bugpoint-reduced-simplified.ll
 ; ModuleID = 'bugpoint-reduced-simplified.bc'
 source_filename = "bugpoint-output-9760709.bc"
 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-pc-linux-gnu"

 ; Function Attrs: norecurse nounwind optsize sspstrong uwtable
 define void @main() local_unnamed_addr #0 {
  tail call void asm sideeffect "outs ${0:l}, ${1:w}",
"{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i8* null, i32 0) #1, !srcloc !1
  ret void
 }

 !llvm.ident = !{!0}

 !0 = !{!"clang version 6.0.1 (tags/RELEASE_601/final)"}
 !1 = !{i32 26}

 $ llc bugpoint-reduced-simplified.ll
 LLVMSymbolizer: error reading file: No such file or directory
 #0 0x00007f8d747157cb llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/bin/../lib/libLLVM-6.0.so+0x8517cb)
 #1 0x00007f8d747134be llvm::sys::RunSignalHandlers()
(/usr/bin/../lib/libLLVM-6.0.so+0x84f4be)
 #2 0x00007f8d7471372b (/usr/bin/../lib/libLLVM-6.0.so+0x84f72b)
 #3 0x00007f8d73ba8e00 __restore_rt (/usr/bin/../lib/libc.so.6+0x37e00)
 #4 0x00007f8d7499b3dc llvm::MachineBasicBlock::getSymbol() const
(/usr/bin/../lib/libLLVM-6.0.so+0xad73dc)
 #5 0x00007f8d74dc5c32 llvm::AsmPrinter::EmitInlineAsm(llvm::MachineInstr
const*) const (/usr/bin/../lib/libLLVM-6.0.so+0xf01c32)
 #6 0x00007f8d74dba824 llvm::AsmPrinter::EmitFunctionBody()
(/usr/bin/../lib/libLLVM-6.0.so+0xef6824)
 #7 0x00007f8d763926bd (/usr/bin/../lib/libLLVM-6.0.so+0x24ce6bd)
 #8 0x00007f8d749e66d0
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/bin/../lib/libLLVM-6.0.so+0xb226d0)
 #9 0x00007f8d747fbaf8 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/bin/../lib/libLLVM-6.0.so+0x937af8)
 #10 0x00007f8d747fbb72 llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/bin/../lib/libLLVM-6.0.so+0x937b72)
 #11 0x00007f8d747fb204 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/bin/../lib/libLLVM-6.0.so+0x937204)
 #12 0x000055bb7b65d63d (llc+0x2163d)
 #13 0x000055bb7b651d65 (llc+0x15d65)
 #14 0x00007f8d73b95223 __libc_start_main (/usr/bin/../lib/libc.so.6+0x24223)
 #15 0x000055bb7b651f3e (llc+0x15f3e)
 Stack dump:
 0.     Program arguments: llc bugpoint-reduced-simplified.ll 
 1.     Running pass 'Function Pass Manager' on module
'bugpoint-reduced-simplified.ll'.
 2.     Running pass 'X86 Assembly Printer' on function '@main'
 [1]    7997 segmentation fault (core dumped)  llc
bugpoint-reduced-simplified.ll

-- 
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/20180827/29d46cdd/attachment.html>


More information about the llvm-bugs mailing list