<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 - [mc] Zero divider is not handled for modulo"
   href="https://bugs.llvm.org/show_bug.cgi?id=35650">35650</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[mc] Zero divider is not handled for modulo
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>MC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>i.am.perminov@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>artem.tamazov@amd.com, dpreobrazhensky@luxoft.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Zero RHS is handled for DIV, but not for MOD operation which leads to crash if
divider is zero:

bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
...
case MCBinaryExpr::Div:
  // Handle division by zero. gas just emits a warning and keeps going,
  // we try to be stricter.
  // FIXME: Currently the caller of this function has no way to understand
  // we're bailing out because of 'division by zero'. Therefore, it will
  // emit a 'expected relocatable expression' error. It would be nice to
  // change this code to emit a better diagnostic.
  if (RHS == 0)
    return false;
  Result = LHS / RHS;
  break;
...
case MCBinaryExpr::Mod:  Result = LHS % RHS; break;</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>