-
-
Notifications
You must be signed in to change notification settings - Fork 267
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 for issue #553. #554
Fix for issue #553. #554
Conversation
Maybe it's best to wait until yebblies/dmd@186acf4 gets merged into ldc. |
The pull request would make life easier. DMD does not generate bounds checking code for static arrays and I try do to the same. :-) |
@redstar: Regarding your question about the comment, maybe DMD didn't implement the proper checks for static arrays in the frontend yet. And if |
@klickverbot Thanks for the explanation. I relaxed the check a bit. If the static indices are found to be outside of the static array, a warning is emitted and a runtime check is generated. |
// If this happens then it is possible a frontend bug. | ||
// Just output a warning and continue generating a runtime check. | ||
// This could be generic code which is never executed. | ||
warning(loc, "Static array index out of bounds (should have been catch during semantic analysis)"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
caught/detected
@redstar That pull request has already been merged into dmd, just not ldc. |
Check if a static array is accessed with a known index. In this case the bounds check can be omitted.
@yebblies Thanks for the pointer. I think I will create another dot-release of 0.12 therefore I like to have this fixed now. But for the next major release I will for sure use |
issue 10720 - ICE with is(aaOfNonCopyableStruct.nonExistingField)
Check if a static array is accessed with a known index. In this case the bounds check can be omitted.
A bit irritating is the comment:
because I do not see where the static bounds and indices might be changed later.