From db7ad508f8ad33389ae507967aebc05aaf31b94b Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 11 Jul 2017 12:37:34 +0100 Subject: Issue proper warning trying to access calldata variables in inline assembly --- libsolidity/analysis/TypeChecker.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libsolidity') diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 7306a36d..90043b43 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -723,7 +723,10 @@ bool TypeChecker::visit(InlineAssembly const& _inlineAssembly) } else if (var->type()->sizeOnStack() != 1) { - m_errorReporter.typeError(_identifier.location, "Only types that use one stack slot are supported."); + if (var->type()->dataStoredIn(DataLocation::CallData)) + m_errorReporter.typeError(_identifier.location, "Call data elements cannot be accessed directly. Copy to a local variable first or use \"calldataload\" or \"calldatacopy\" with manually determined offsets and sizes."); + else + m_errorReporter.typeError(_identifier.location, "Only types that use one stack slot are supported."); return size_t(-1); } } -- cgit