Fix bug related to new code gen testing.

This commit is contained in:
Bhargava Shastry 2021-03-11 13:57:20 +01:00
parent 67a4d6f01d
commit 7c572dbfdf
2 changed files with 16 additions and 10 deletions

View File

@ -109,6 +109,10 @@ public:
{
m_compilerInput.optimiserSettings = _opt;
}
void viaIR(bool _viaIR)
{
m_compilerInput.viaIR = _viaIR;
}
void reset(bool _keepSettings)
{
m_compiler.reset(_keepSettings);
@ -178,6 +182,10 @@ public:
{
m_compilationFramework.optSetting(_opt);
}
void viaIR(bool _viaIR)
{
m_compilationFramework.viaIR(_viaIR);
}
/// @returns the result of the execution of the function whose
/// keccak256 hash is @param _functionHash that is deployed at

View File

@ -22,10 +22,12 @@
#include <test/TestCaseReader.h>
#include <evmone/evmone.h>
#include <libyul/backends/evm/EVMCodeTransform.h>
#include <liblangutil/EVMVersion.h>
#include <evmone/evmone.h>
#include <sstream>
using namespace solidity::frontend::test;
@ -112,18 +114,10 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
compilerSetting.runYulOptimiser = true;
compilerSetting.optimizeStackAllocation = true;
CompilerInput cInputOpt = {
version,
sourceCode,
contractName,
compilerSetting,
{},
false,
true
};
hostContext.reset();
evmoneUtil.reset(true);
evmoneUtil.optSetting(compilerSetting);
evmoneUtil.viaIR(true);
auto compilerOutputOpt = evmoneUtil.compileContract();
solAssert(compilerOutputOpt.has_value(), "Contract could not be optimised.");
@ -162,6 +156,10 @@ extern "C" int LLVMFuzzerTestOneInput(uint8_t const* _data, size_t _size)
{
return 0;
}
catch (solidity::yul::StackTooDeepError const&)
{
return 0;
}
}
return 0;
}