Skip to content

Negative values of signed ints treated as positive array indexes #2468

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

Closed
msullivan opened this issue May 30, 2012 · 0 comments
Closed

Negative values of signed ints treated as positive array indexes #2468

msullivan opened this issue May 30, 2012 · 0 comments
Labels
A-codegen Area: Code generation

Comments

@msullivan
Copy link
Contributor

Negative values of signed ints will be treated as positive for the purpose of indexing into arrays. This only comes up when using narrow int types. foo[-1i8] is equivalent to foo[255].

We think the solution is to sign extend array indexes in trans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation
Projects
None yet
Development

No branches or pull requests

1 participant