diff --git a/libsolidity/codegen/CompilerUtils.cpp b/libsolidity/codegen/CompilerUtils.cpp index f9a0fbcec..c15d2537e 100644 --- a/libsolidity/codegen/CompilerUtils.cpp +++ b/libsolidity/codegen/CompilerUtils.cpp @@ -605,7 +605,7 @@ void CompilerUtils::zeroInitialiseMemoryArray(ArrayType const& _type) Whiskers templ(R"({ let size := mul(length, ) // cheap way of zero-initializing a memory range - codecopy(memptr, codesize(), size) + calldatacopy(memptr, calldatasize(), size) memptr := add(memptr, size) })"); templ("element_size", to_string(_type.memoryStride())); diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index a1d200f89..2fee45abc 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -10131,7 +10131,7 @@ BOOST_AUTO_TEST_CASE(create_dynamic_array_with_zero_length) BOOST_AUTO_TEST_CASE(correctly_initialize_memory_array_in_constructor) { - // Memory arrays are initialized using codecopy past the size of the code. + // Memory arrays are initialized using calldatacopy past the size of the calldata. // This test checks that it also works in the constructor context. char const* sourceCode = R"( contract C {