Skip to content
New issue

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

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

Already on GitHub? # to your account

compile_lll.py: buggy translation of constant clamp expressions #450

Closed
daejunpark opened this issue Nov 9, 2017 · 0 comments
Closed

compile_lll.py: buggy translation of constant clamp expressions #450

daejunpark opened this issue Nov 9, 2017 · 0 comments

Comments

@daejunpark
Copy link
Contributor

What's your issue about?

The following logic is not correct for the cases: uclampgt, uclampge, clampgt, clampge:
https://github.com/ethereum/viper/blob/b1fe12ddd8706ef3340a103916e3d3f2cc95ceef/viper/compile_lll.py#L157-L162

How can it be fixed?

Change the following line:
https://github.com/ethereum/viper/blob/b1fe12ddd8706ef3340a103916e3d3f2cc95ceef/viper/compile_lll.py#L159
to something like:

if ((0 <= code.args[0].value < code.args[1].value) and code.value in ('uclamplt', 'uclample', 'clamplt', 'clample'))
or ((0 <= code.args[1].value < code.args[0].value) and code.value in ('uclampgt', 'uclampge', 'clampgt', 'clampge')):

Cute Animal Picture

<°(((((((><
DavidKnott added a commit that referenced this issue Nov 13, 2017
Fix issue #450: buggy translation of constant clamp expressions
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant