<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - LLVM 12 regression: emits bogus inline assembly error without proper error handling"
   href="https://bugs.llvm.org/show_bug.cgi?id=49376">49376</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLVM 12 regression: emits bogus inline assembly error without proper error handling
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>release blocker
          </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>andrew@ziglang.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>LLVM 12, release candidate 2 (4918a3d138b907a571f496661b5367e090e1e8bb)

# Steps to reproduce:


git clone <a href="https://github.com/ziglang/zig">https://github.com/ziglang/zig</a>
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.</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>