aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorBob Summerwill <bob@summerwill.net>2016-04-01 00:46:35 +0800
committerBob Summerwill <bob@summerwill.net>2016-04-01 00:46:35 +0800
commit15a4f4d322bbc378beb9a9f0429c9f1cd6dd3893 (patch)
tree4826f3b5a08eb9c27962c2538c63533aa26c3c26 /libsolidity
parent9fbd5c32157731a7d8f8a14bfd67ff746bf605d7 (diff)
parent2c29492227553e3861089a0dc944b60fafcb7055 (diff)
downloaddexon-solidity-15a4f4d322bbc378beb9a9f0429c9f1cd6dd3893.tar.gz
dexon-solidity-15a4f4d322bbc378beb9a9f0429c9f1cd6dd3893.tar.zst
dexon-solidity-15a4f4d322bbc378beb9a9f0429c9f1cd6dd3893.zip
Merge pull request #465 from chriseth/fixindexaccess
Clean higher order bits before array index access.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index 64eb6710..a17ec2f6 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -1069,6 +1069,7 @@ bool ExpressionCompiler::visit(IndexAccess const& _indexAccess)
solAssert(_indexAccess.indexExpression(), "Index expression expected.");
_indexAccess.indexExpression()->accept(*this);
+ utils().convertType(*_indexAccess.indexExpression()->annotation().type, IntegerType(256), true);
// stack layout: <base_ref> [<length>] <index>
ArrayUtils(m_context).accessIndex(arrayType);
switch (arrayType.location())
@@ -1104,6 +1105,7 @@ bool ExpressionCompiler::visit(IndexAccess const& _indexAccess)
solAssert(_indexAccess.indexExpression(), "Index expression expected.");
_indexAccess.indexExpression()->accept(*this);
+ utils().convertType(*_indexAccess.indexExpression()->annotation().type, IntegerType(256), true);
// stack layout: <value> <index>
// check out-of-bounds access
m_context << u256(fixedBytesType.numBytes());