codegen: cleanup values to fit in storage bytes

This commit is contained in:
Yoichi Hirai 2016-11-25 15:50:46 +01:00
parent 548b7ce42d
commit 0be5859503
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992

View File

@ -738,6 +738,10 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp
default:
// All other types should not be convertible to non-equal types.
solAssert(_typeOnStack == _targetType, "Invalid type conversion requested.");
if (_cleanupNeeded && _targetType.canBeStored() && _targetType.storageBytes() < 32)
m_context
<< ((u256(1) << (8 * _targetType.storageBytes())) - 1)
<< Instruction::AND;
break;
}