<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 - Assertion failure in WebAssemblyFastISel"
   href="https://bugs.llvm.org/show_bug.cgi?id=47933">47933</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failure in WebAssemblyFastISel
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jjorge@quarkslab.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24086" name="attach_24086" title="Output of the crash">attachment 24086</a> <a href="attachment.cgi?id=24086&action=edit" title="Output of the crash">[details]</a></span>
Output of the crash

When compiling the reduced test case below for the wasm32 target with

clang -target wasm32 -c test.ll  -o /dev/null

Where test.ll is

target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"

define private void @failing(i32 %0) {
entry:
  %1 = alloca i8, i32 4
  %2 = ptrtoint i8* %1 to i32
  %3 = and i32 %2, 2
  %4 = add i32 %2, %3
  %5 = inttoptr i32 %4 to i32*
  store i32 %0, i32* %5
  ret void
}
```

Clang fails with the following message:

llvm/lib/Target/WebAssembly/WebAssemblyFastISel.cpp:76: void (anonymous
namespace)::WebAssemblyFastISel::Address::setReg(unsigned int): Assertion
`isRegBase() && "Invalid base register access!"' failed.

See the attached log for details.</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>