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

Handle overflow/large constants in constant-sized ranges better #416

Open
dtarditi opened this issue Nov 13, 2017 · 0 comments
Open

Handle overflow/large constants in constant-sized ranges better #416

dtarditi opened this issue Nov 13, 2017 · 0 comments
Labels
future work This labels issues that need further triaging and discussion.

Comments

@dtarditi
Copy link
Contributor

Checking logical statements involving constant-sized ranges gives up when it encounters overflow involving constants in programs (it returns Maybe). For example, for p + i, we need to scale i by the size of the referent type of p. That could overflow. We should return False and an error condition when that happens. The computation would fault at runtime (you can argue that a logical statement is false, because there is no program state for which it is true).

Also, we use signed integers that are the size of pointers to represent offsets. We will indicate overflow when a constant that is an unsigned integer is too large to be represented in these signed integer. The simple solution of using n+1 bits is not a good idea from a compiler performance perspective but it forces memory allocation for the common case. We should use n+1 bits only when necessary, but that means special-casing the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
future work This labels issues that need further triaging and discussion.
Projects
None yet
Development

No branches or pull requests

2 participants