From 21caa43f2cbc595f27843e0600518fe4b3d3ab19 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Tue, 9 May 2023 17:27:30 +0200 Subject: [PATCH] Test case showing gas usage before optimization. --- .../errors/small_error_optimization.sol | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/libsolidity/semanticTests/errors/small_error_optimization.sol diff --git a/test/libsolidity/semanticTests/errors/small_error_optimization.sol b/test/libsolidity/semanticTests/errors/small_error_optimization.sol new file mode 100644 index 000000000..79f6f563f --- /dev/null +++ b/test/libsolidity/semanticTests/errors/small_error_optimization.sol @@ -0,0 +1,19 @@ +error E(); +contract A { + uint8[] x; + function f() public { + for (uint i = 0; i < 100; ++i) + x.push(uint8(i)); + revert E(); + } +} +contract B { + function f() public { + (new A()).f(); + } +} +// ---- +// f() -> FAILURE, hex"92bbf6e8" +// gas irOptimized: 274265 +// gas legacy: 310592 +// gas legacyOptimized: 273662