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

Issue 12928 - Range check dropped for array[length] #3671

Merged
merged 1 commit into from
Jun 17, 2014

Conversation

lionello
Copy link
Contributor

IntRanges in DMD are inclusive. The range check would get dropped if the expression for the index was contained within [0..length]-inclusive. This would drop the range check for [length].

https://issues.dlang.org/show_bug.cgi?id=12928

@@ -0,0 +1,12 @@
import core.exception : RangeError;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this needs // PERMUTE_ARGS:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added. Although all flags except -noboundscheck should be fine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default compiler switch permutation for runnable cases is -inline -release -g -O, so PERMUTE_ARGS: -inline -g -O is better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default permute set is "-inline -release -gc -O -unittest -fPIC", look in dmd/test/Makefile. In the auto tester, for pulls, the set is reduced to "-O -inline -release" to reduce the test time.

@lionello
Copy link
Contributor Author

I see: -release drops bounds check for non-@safe modules. Tried to make main @safe but wouldn't let me catch RangeError in that case. Going with @9rnsr suggestion.

@9rnsr
Copy link
Contributor

9rnsr commented Jun 17, 2014

Auto-merge toggled on

9rnsr added a commit that referenced this pull request Jun 17, 2014
Issue 12928 - Range check dropped for array[length]
@9rnsr 9rnsr merged commit 25e77d3 into dlang:master Jun 17, 2014
@lionello lionello deleted the bug12928 branch June 17, 2014 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants