From e29047b24d149e6b27962f9fe89e8275e213c11d Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Thu, 1 Dec 2016 11:58:34 +0100 Subject: [PATCH 1/2] codegen: assertion did not assert non-nullness This commit strengthens an assertion so that it makes sure that a pointer is not null. Moreover, `isLocalVariable(variable)` is now positively asserted, following the error message. --- libsolidity/codegen/ContractCompiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index 437c484a3..124546de0 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -583,7 +583,7 @@ bool ContractCompiler::visit(InlineAssembly const& _inlineAssembly) // lvalue context auto variable = dynamic_cast(decl); solAssert( - !!variable || !m_context.isLocalVariable(variable), + !!variable && m_context.isLocalVariable(variable), "Can only assign to stack variables in inline assembly." ); unsigned size = variable->type()->sizeOnStack(); From 422140f60369a2e69c6cb446528737d5d23a3e3d Mon Sep 17 00:00:00 2001 From: Yoichi Hirai Date: Thu, 1 Dec 2016 12:26:52 +0100 Subject: [PATCH 2/2] test: more precise expectation about the error for assigning into storage in inline assembly --- test/libsolidity/SolidityNameAndTypeResolution.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 7a132068f..d8c5924e8 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -4521,7 +4521,7 @@ BOOST_AUTO_TEST_CASE(inline_assembly_storage) } } )"; - CHECK_ERROR(text, DeclarationError, ""); + CHECK_ERROR(text, DeclarationError, "not found, not unique or not lvalue."); } BOOST_AUTO_TEST_CASE(inline_assembly_storage_in_modifiers)