diff --git a/Changelog.md b/Changelog.md index a24ac211c..8fa54c818 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ Features: Bugfixes: + * Type checker: forbid signed exponential that led to an incorrect use of EXP opcode. ### 0.4.3 (2016-10-25) diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 7cfed3c88..7fe97fa76 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -349,11 +349,14 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe return commonType; if (Token::isBooleanOp(_operator)) return TypePointer(); - // Nothing else can be done with addresses if (auto intType = dynamic_pointer_cast(commonType)) { + // Nothing else can be done with addresses if (intType->isAddress()) return TypePointer(); + // Signed EXP is not allowed + if (Token::Exp == _operator && intType->isSigned()) + return TypePointer(); } else if (auto fixType = dynamic_pointer_cast(commonType)) if (Token::Exp == _operator)