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

Fix bounds checking for 16-bit targets (Issue #2520) #2530

Conversation

luismarques
Copy link
Contributor

@luismarques luismarques commented Jan 21, 2018

Fixes Issue #2520

This undoes the automatic zero extension of the index value used in the array bounds checking (back to size_t, which will not be a 32-bit for 16-bit targets). That fixes an internal LDC error that occurs when compiling, with bounds checking on, code like this:

void test()
{
    int[1] array;
    ushort k = 0;
    auto value = array[k];
}

@luismarques luismarques changed the title Fix bounds checking for 16-bit targets Fix bounds checking for 16-bit targets (Issue 2520) Jan 21, 2018
@luismarques luismarques changed the title Fix bounds checking for 16-bit targets (Issue 2520) Fix bounds checking for 16-bit targets (Issue #2520) Jan 21, 2018
@JohanEngelen
Copy link
Member

Needs a testcase.

@luismarques luismarques force-pushed the fix-16-bit-bounds-checking branch from 54c5b6e to 48de46d Compare January 21, 2018 15:51
@luismarques luismarques force-pushed the fix-16-bit-bounds-checking branch from 48de46d to 62f693a Compare January 21, 2018 15:52
@luismarques
Copy link
Contributor Author

Now with a test.

@kinke
Copy link
Member

kinke commented Jan 21, 2018

I think it makes sense to investigate where the zero-extension from i16 to i32 comes from, as this may just be a symptom of a more general issue. Studying the -vv output, starting from the back, should give insight.

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.

3 participants