evmasm codegen 会旋转不断增长的嵌套元组组件的堆栈槽
作者: matheusaaguiar创建于 2026年9月30日更新于 2026年9月30日
标签bug :bug:
// SPDX-License-Identifier: GPL-3.0
// 与 C.silent() 相同,但兼容 0.6,以定位回归点。正确输出中,第一个 32 字节单词为 "7800..."。
pragma solidity >=0.6.0;
contract B {
function silent() external pure returns (bytes32 z, uint256 a, uint256 b) {
((z, a), b) = (("x", 111), 222);
}
}
((z, a), b) = (("x", 111), 222) 与 bytes32 z; uint256 a 返回 z = 111 和 a = bytes32("x") — 两个组件交换了位置,编译器不会生成任何错误或警告。
根本原因
CompilerUtils::convertType,元组情况 — CompilerUtils.cpp#L1276-L1292 在测试版 8a079791d9cca7a6c03fd6a8429b93aa3bddefed 中。每个组件都被复制到堆栈顶部,然后转换,最后被写回到它来自的 S = sourceSize 位置,其中 T = targetSize:
内容来源: argotorg/solidity