[llvm] r247471 - [MC] Don't crash on division by zero.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 11 15:06:09 PDT 2015


On Fri, Sep 11, 2015 at 2:23 PM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
>> +    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;
>> +    }
>
> You don't need the {}
> The break should be on the next line.
>

r247483. Sorry about that, Rafael.


-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare


More information about the llvm-commits mailing list