Fixing additional signedness errors after adding -Wsign-conversion flag

Co-authored-by: Kamil Śliwak <kamil.sliwak@codepoets.it>
This commit is contained in:
Djordje Mijovic
2020-07-09 17:22:45 +02:00
co-authored by Kamil Śliwak
parent 3c57e04751
commit 547590b972
12 changed files with 20 additions and 20 deletions
+2 -2
View File
@@ -184,13 +184,13 @@ void ProtoConverter::visit(VarRef const& _x)
{
// Ensure that there is at least one variable declaration to reference in function scope.
yulAssert(m_currentFuncVars.size() > 0, "Proto fuzzer: No variables to reference.");
m_output << *m_currentFuncVars[_x.varnum() % m_currentFuncVars.size()];
m_output << *m_currentFuncVars[static_cast<size_t>(_x.varnum()) % m_currentFuncVars.size()];
}
else
{
// Ensure that there is at least one variable declaration to reference in nested scopes.
yulAssert(m_currentGlobalVars.size() > 0, "Proto fuzzer: No global variables to reference.");
m_output << *m_currentGlobalVars[_x.varnum() % m_currentGlobalVars.size()];
m_output << *m_currentGlobalVars[static_cast<size_t>(_x.varnum()) % m_currentGlobalVars.size()];
}
}
+1 -1
View File
@@ -202,7 +202,7 @@ DEFINE_PROTO_FUZZER(Program const& _input)
// With libFuzzer binary run this to generate a YUL source file x.yul:
// PROTO_FUZZER_DUMP_PATH=x.yul ./a.out proto-input
ofstream of(dump_path);
of.write(sol_source.data(), sol_source.size());
of.write(sol_source.data(), static_cast<streamsize>(sol_source.size()));
}
if (char const* dump_path = getenv("SOL_DEBUG_FILE"))
+1 -1
View File
@@ -43,7 +43,7 @@ DEFINE_PROTO_FUZZER(Program const& _input)
// With libFuzzer binary run this to generate a YUL source file x.yul:
// PROTO_FUZZER_DUMP_PATH=x.yul ./a.out proto-input
ofstream of(dump_path);
of.write(yul_source.data(), yul_source.size());
of.write(yul_source.data(), static_cast<streamsize>(yul_source.size()));
}
if (yul_source.size() > 1200)
+1 -1
View File
@@ -64,7 +64,7 @@ DEFINE_PROTO_FUZZER(Program const& _input)
// With libFuzzer binary run this to generate a YUL source file x.yul:
// PROTO_FUZZER_DUMP_PATH=x.yul ./a.out proto-input
ofstream of(dump_path);
of.write(yul_source.data(), yul_source.size());
of.write(yul_source.data(), static_cast<streamsize>(yul_source.size()));
}
YulStringRepository::reset();
+2 -2
View File
@@ -179,8 +179,8 @@ BOOST_AUTO_TEST_CASE(alternativeMutations_should_choose_between_mutations_with_g
for (size_t i = 0; i < 10; ++i)
{
Chromosome mutatedChromosome = mutation(chromosome);
cCount += (mutatedChromosome == Chromosome("c") ? 1 : 0);
fCount += (mutatedChromosome == Chromosome("f") ? 1 : 0);
cCount += (mutatedChromosome == Chromosome("c") ? 1u : 0u);
fCount += (mutatedChromosome == Chromosome("f") ? 1u : 0u);
}
// This particular seed results in 7 "c"s out of 10 which looks plausible given the 80% chance.