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

gasLimit should be int64_t #42

Open
mgraczyk opened this issue Nov 23, 2017 · 1 comment
Open

gasLimit should be int64_t #42

mgraczyk opened this issue Nov 23, 2017 · 1 comment

Comments

@mgraczyk
Copy link

On this line, gasLimit is compared with ~9 billion, a number larger than the largest int on most/all platforms.
https://github.com/comaeio/porosity/blob/cdca1693857fe99af546e294756c693536731833/porosity/porosity/VMState.cpp#L344

This definition should be int64_t gasLimit = int64_t...:
https://github.com/comaeio/porosity/blob/cdca1693857fe99af546e294756c693536731833/porosity/porosity/VMState.cpp#L314

@ldub
Copy link

ldub commented Mar 8, 2018

Also, -Wtautological-constant-out-of-range-compare causes a warning for this comparison when compiling.

> make
c++ -std=c++14   -c -o BasicBlocks.o BasicBlocks.cpp
c++ -std=c++14   -c -o CommonData.o CommonData.cpp
c++ -std=c++14   -c -o Contract.o Contract.cpp
c++ -std=c++14   -c -o Debug.o Debug.cpp
c++ -std=c++14   -c -o Disassm.o Disassm.cpp
c++ -std=c++14   -c -o Instruction.o Instruction.cpp
c++ -std=c++14   -c -o Output.o Output.cpp
c++ -std=c++14   -c -o Porosity.o Porosity.cpp
c++ -std=c++14   -c -o SHA3.o SHA3.cpp
c++ -std=c++14   -c -o Statement.o Statement.cpp
c++ -std=c++14   -c -o Utils.o Utils.cpp
c++ -std=c++14   -c -o VMState.o VMState.cpp
VMState.cpp:344:26: warning: comparison of constant 9999965936 with expression of type 'int' is always true [-Wtautological-constant-out-of-range-compare]
            if (gasLimit != 0x2540B5EF0) exp << ".gas(" << gasLimit << ")";
                ~~~~~~~~ ^  ~~~~~~~~~~~
1 warning generated.
c++ -std=c++14    BasicBlocks.o CommonData.o Contract.o Debug.o Disassm.o Instruction.o Output.o Porosity.o SHA3.o Statement.o Utils.o VMState.o   -o porosity

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

No branches or pull requests

2 participants