aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-10-25 02:12:31 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-10-25 22:49:10 +0800
commit3ca5900b8c0b69d640ef46388b0d2250275356fc (patch)
tree33d044a39ec84cd20c505b62c0d440ad78ee6617
parent578b02bb37bf7cc2fa8cdcb745eaeef5591ea27e (diff)
downloaddexon-solidity-3ca5900b8c0b69d640ef46388b0d2250275356fc.tar
dexon-solidity-3ca5900b8c0b69d640ef46388b0d2250275356fc.tar.gz
dexon-solidity-3ca5900b8c0b69d640ef46388b0d2250275356fc.tar.bz2
dexon-solidity-3ca5900b8c0b69d640ef46388b0d2250275356fc.tar.lz
dexon-solidity-3ca5900b8c0b69d640ef46388b0d2250275356fc.tar.xz
dexon-solidity-3ca5900b8c0b69d640ef46388b0d2250275356fc.tar.zst
dexon-solidity-3ca5900b8c0b69d640ef46388b0d2250275356fc.zip
ast: ban signed EXP, fixing #1246
-rw-r--r--Changelog.md1
-rw-r--r--libsolidity/ast/Types.cpp5
2 files changed, 5 insertions, 1 deletions
diff --git a/Changelog.md b/Changelog.md
index a24ac211..8fa54c81 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 7cfed3c8..7fe97fa7 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<IntegerType const>(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<FixedPointType const>(commonType))
if (Token::Exp == _operator)