bump simplecpp
This commit is contained in:
parent
f1839ebfaf
commit
63493c229d
|
@ -473,10 +473,13 @@ void simplecpp::TokenList::constFoldMulDivRem(Token *tok) {
|
||||||
long long rhs = std::stoll(tok->next->str);
|
long long rhs = std::stoll(tok->next->str);
|
||||||
if (rhs == 0)
|
if (rhs == 0)
|
||||||
throw std::overflow_error("division/modulo by zero");
|
throw std::overflow_error("division/modulo by zero");
|
||||||
|
long long lhs = std::stoll(tok->previous->str);
|
||||||
|
if (rhs == -1 && lhs == std::numeric_limits<long long>::min())
|
||||||
|
throw std::overflow_error("division overflow");
|
||||||
if (tok->op == '/')
|
if (tok->op == '/')
|
||||||
result = (std::stoll(tok->previous->str) / rhs);
|
result = (lhs / rhs);
|
||||||
else
|
else
|
||||||
result = (std::stoll(tok->previous->str) % rhs);
|
result = (lhs % rhs);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue