Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions solc/CommandLineParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,7 @@ OptimiserSettings CommandLineOptions::optimiserSettings() const
settings = OptimiserSettings::minimal();

settings.runYulOptimiser = optimizer.optimizeYul;
if (optimizer.optimizeYul)
// NOTE: Standard JSON disables optimizeStackAllocation by default when yul optimizer is disabled.
// --optimize --no-optimize-yul on the CLI does not have that effect.
settings.optimizeStackAllocation = true;
settings.optimizeStackAllocation = optimizer.optimizeYul;

if (optimizer.expectedExecutionsPerDeployment.has_value())
settings.expectedExecutionsPerDeployment = optimizer.expectedExecutionsPerDeployment.value();
Expand Down
1 change: 1 addition & 0 deletions test/cmdlineTests/optimizer_evmasm_only_no_yul/args
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--optimize --no-optimize-yul --bin
11 changes: 11 additions & 0 deletions test/cmdlineTests/optimizer_evmasm_only_no_yul/input.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity *;

// Test case for issue #16306: --optimize --no-optimize-yul should not cause ICE
contract C {
struct A { string a; }
function f() public pure returns (A memory) {
A memory t;
return t;
}
}
4 changes: 4 additions & 0 deletions test/cmdlineTests/optimizer_evmasm_only_no_yul/output
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

======= input.sol:C =======
Binary:
<BYTECODE REMOVED>
1 change: 1 addition & 0 deletions test/solc/CommandLineParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ BOOST_AUTO_TEST_CASE(optimizer_flags)

OptimiserSettings evmasmOnly = OptimiserSettings::standard();
evmasmOnly.runYulOptimiser = false;
evmasmOnly.optimizeStackAllocation = false;

std::map<std::vector<std::string>, OptimiserSettings> settingsMap = {
{{}, OptimiserSettings::minimal()},
Expand Down