test: Rewrite an unit test to avoid UBSan warning

Previously in the last iteration of the for loop the value EVMC_MAX_REVISION + 1 is assigned to rev of type evmc_revision what triggers an UBSan warning.
This commit is contained in:
Paweł Bylica 2019-06-26 13:37:36 +02:00
parent e2a162d28c
commit a31c82373f
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
1 changed files with 2 additions and 2 deletions

View File

@ -113,9 +113,9 @@ TEST(instructions, constantinople_hard_fork)
TEST(instructions, name_gas_cost_equivalence) TEST(instructions, name_gas_cost_equivalence)
{ {
for (auto rev = EVMC_FRONTIER; rev <= EVMC_MAX_REVISION; for (auto r = int{EVMC_FRONTIER}; r <= EVMC_MAX_REVISION; ++r)
rev = static_cast<evmc_revision>(rev + 1))
{ {
const auto rev = static_cast<evmc_revision>(r);
const auto names = evmc_get_instruction_names_table(rev); const auto names = evmc_get_instruction_names_table(rev);
const auto metrics = evmc_get_instruction_metrics_table(rev); const auto metrics = evmc_get_instruction_metrics_table(rev);