[llvm-bugs] [Bug 49376] New: LLVM 12 regression: emits bogus inline assembly error without proper error handling

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 28 21:26:36 PST 2021


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

            Bug ID: 49376
           Summary: LLVM 12 regression: emits bogus inline assembly error
                    without proper error handling
           Product: new-bugs
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: andrew at ziglang.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

LLVM 12, release candidate 2 (4918a3d138b907a571f496661b5367e090e1e8bb)

# Steps to reproduce:


git clone https://github.com/ziglang/zig
git checkout llvm12
# At time of reporting, the current latest commit in this branch is
72404db31f76635f11d0aa4dcc02c149ef885b3d.
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH="$PATH_TO_YOUR_LLVM12_PREFIX"
make
./zig test ../test/stage1/behavior.zig -target i386-linux -I ../test

# Expected output

Test [967/997] behavior.vector.test "vector shift operators"...SKIP
996 passed; 1 skipped.

# Actual output

<inline asm>:1:3: error: ambiguous instructions require an explicit suffix
(could be 'pushw', or 'pushl')
         push -28(%ebp)
         ^
LLVM ERROR: Error parsing inline asm

Aborted (core dumped)

# More details

There is no inline assembly in zig that has `push -28(%ebp)` in it. If you grep
for `push -28` there are no results. Furthermore, I tried dumping the LLVM IR
module, and compiling it with llc, and it compiled fine. The LLVM IR module
does not have that inline assembly in it.

Another problem here is that LLVM is calling abort():

Thread 1 "zig" received signal SIGABRT, Aborted.
0x00007ffff7abb08a in raise ()
   from /nix/store/33idnvrkvfgd5lsx2pwgwwi955adl6sk-glibc-2.31/lib/libc.so.6
(gdb) up
#1  0x00007ffff7aa5528 in abort ()
   from /nix/store/33idnvrkvfgd5lsx2pwgwwi955adl6sk-glibc-2.31/lib/libc.so.6
(gdb) 
#2  0x0000000006a85c73 in llvm::report_fatal_error(llvm::Twine const&, bool) ()
(gdb) 
#3  0x0000000006a85d88 in llvm::report_fatal_error(char const*, bool) ()
(gdb) 
#4  0x000000000551bdb3 in llvm::AsmPrinter::emitInlineAsm(llvm::StringRef,
llvm::MCSubtargetInfo const&, llvm::MCTargetOptions const&, llvm::MDNode
const*, llvm::InlineAsm::AsmDialect) const ()
(gdb) 
#5  0x000000000551d1ed in llvm::AsmPrinter::emitInlineAsm(llvm::MachineInstr
const*) const ()
(gdb) 
#6  0x00000000055187d8 in llvm::AsmPrinter::emitFunctionBody() ()
(gdb) 
#7  0x0000000003e75b4f in
llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&) ()
(gdb) 
#8  0x00000000059e20e4 in
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) ()
(gdb) 
#9  0x000000000696d890 in llvm::FPPassManager::runOnFunction(llvm::Function&)
()
(gdb) 
#10 0x000000000696ee11 in llvm::FPPassManager::runOnModule(llvm::Module&) ()
(gdb) 
#11 0x000000000696cb08 in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
(gdb) 
#12 0x000000000160ce86 in ZigLLVMTargetMachineEmitToFile
(targ_machine_ref=0x987e400, 


This is not OK; LLVM is a library that needs to report errors to the
application, which has its own error handling mechanism. LLVM is a library that
already has an error handling mechanism; writing directly to stderr and calling
abort() is a serious bug.


This is a regression from LLVM 11, where the actual behavior and expected
behavior match.

-- 
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/20210301/289d0721/attachment.html>


More information about the llvm-bugs mailing list