mirror of https://github.com/status-im/evmc.git
vmtester: better way to avoid compiler optimisations
This commit is contained in:
parent
a2b011e334
commit
cd993e1388
|
@ -10,6 +10,24 @@
|
|||
#include <array>
|
||||
#include <cstring>
|
||||
|
||||
namespace
|
||||
{
|
||||
// NOTE: this is to avoid compiler optimisations when reading the buffer
|
||||
uint8_t read_uint8(const volatile uint8_t* p)
|
||||
{
|
||||
return *p;
|
||||
}
|
||||
|
||||
void read_buffer(const uint8_t* ptr, size_t size)
|
||||
{
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
read_uint8(&ptr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_F(evmc_vm_test, abi_version_match)
|
||||
{
|
||||
ASSERT_EQ(vm->abi_version, EVMC_ABI_VERSION);
|
||||
|
@ -49,10 +67,7 @@ TEST_F(evmc_vm_test, execute)
|
|||
else
|
||||
{
|
||||
EXPECT_NE(result.output_size, 0);
|
||||
|
||||
// Dereference pointer.
|
||||
uint8_t tmp = result.output_data[0];
|
||||
(void)tmp;
|
||||
read_buffer(result.output_data, result.output_size);
|
||||
}
|
||||
|
||||
if (result.release)
|
||||
|
|
Loading…
Reference in New Issue