bump simplecpp

This commit is contained in:
Daniel Marjamäki 2016-07-20 20:40:16 +02:00
parent f1839ebfaf
commit 63493c229d
1 changed files with 5 additions and 2 deletions

View File

@ -473,10 +473,13 @@ void simplecpp::TokenList::constFoldMulDivRem(Token *tok) {
long long rhs = std::stoll(tok->next->str);
if (rhs == 0)
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 == '/')
result = (std::stoll(tok->previous->str) / rhs);
result = (lhs / rhs);
else
result = (std::stoll(tok->previous->str) % rhs);
result = (lhs % rhs);
}
else
continue;