Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2] Fix compile warnings in eos-vm-oc's memory.hpp, executor.cpp, and memory.cpp #615

Merged
merged 3 commits into from
Jul 7, 2022

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Jul 6, 2022

Resolve #612

Fix the following warnings. Please double check if my fixes for memory.cpp and executor.cpp do not break anything. Thanks.

.../libraries/chain/include/eosio/chain/webassembly/eos-vm-oc/memory.hpp:53:32: warning: comparison of integer expressions of different signedness: ‘long unsigned int’ and ‘int’ [-Wsign-compare]
   53 |       static_assert(-cb_offset == EOS_VM_OC_CONTROL_BLOCK_OFFSET, "EOS VM OC control block offset has slid out of place somehow");

.../libraries/chain/webassembly/runtimes/eos-vm-oc/memory.cpp: In constructor ‘eosio::chain::eosvmoc::memory::memory(uint64_t)’:
.../libraries/chain/webassembly/runtimes/eos-vm-oc/memory.cpp:37:25: warning: ‘last’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   37 |    fullpage_base = last + memory_prologue_size;
      |                    ~~~~~^~~~~~~~~~~~~~~~~~~~~~

.../libraries/chain/webassembly/runtimes/eos-vm-oc/executor.cpp: In lambda function:
.../libraries/chain/webassembly/runtimes/eos-vm-oc/executor.cpp:227:42: warning: comparison of integer expressions of different signedness: ‘int64_t’ {aka ‘long  int’} and ‘uint64_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  227 |       if(cb->current_linear_memory_pages > base_pages) {
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~

@linh2931 linh2931 requested review from heifner and spoonincode July 6, 2022 22:10
static_assert(-cb_offset == EOS_VM_OC_CONTROL_BLOCK_OFFSET, "EOS VM OC control block offset has slid out of place somehow");
// Changed from -cb_offset == EOS_VM_OC_CONTROL_BLOCK_OFFSET to get around
// of compile warning about comparing integers of different signedness
static_assert(EOS_VM_OC_CONTROL_BLOCK_OFFSET + cb_offset == 0, "EEOS VM OC control block offset has slid out of place somehow");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo introduced in to string here (EEOS)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @spoonincode for your sharp eyes! Sorry for that.

@linh2931 linh2931 merged commit d6b55a9 into main Jul 7, 2022
@linh2931 linh2931 deleted the fix_memory_h_warning branch July 7, 2022 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compile warnings in eos-vm-oc's memory.hpp, memory.cpp, and executor.cpp
2 participants