[llvm-bugs] [Bug 35650] New: [mc] Zero divider is not handled for modulo
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Dec 13 08:20:21 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35650
Bug ID: 35650
Summary: [mc] Zero divider is not handled for modulo
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: MC
Assignee: unassignedbugs at nondot.org
Reporter: i.am.perminov at gmail.com
CC: artem.tamazov at amd.com, dpreobrazhensky at luxoft.com,
llvm-bugs at lists.llvm.org
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;
--
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/20171213/52737338/attachment.html>
More information about the llvm-bugs
mailing list