-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
String nextind
is inconsistent about what to do with out-of-bounds indices
#26511
Comments
The doc string is out of date in that case. I thought @bkamins or I had updated them, but perhaps that didn't happen. The valid index range is |
Ok, but then we have bigger problems, because the string tests call nextind with invalid indices all over the place, only hidden by |
Why isn't the sysimg built with bounds checking always on when testing? |
List of failures I see on my branch with broken boundscheck elim: https://gist.github.com/Keno/4bd3892b8c2cd431f9084858d3bb09df Can't promise that some of these aren't due to optimizer bugs on that branch. |
It seems to me that it should be rathe optimizer bug on that branch. The relevant part of the code is:
Given the test above (that passes) |
I think what looks like is happening in at least some of those examples is that nextind on the last index in the range accesses the underlying string data past the acceptable range. |
Yes, there seems to be a bug in the line 141 of string.jl:
which causes problem if |
nextind
is schizophrenic about what to do with out-of-bounds indiciesnextind
is inconsistent about what to do with out-of-bounds indicies
nextind
is inconsistent about what to do with out-of-bounds indiciesnextind
is inconsistent about what to do with out-of-bounds indices
AFAICT, the issues Keno found are fixed now (where sys.ji is a copy of sys.so without native code)
|
The docstring states that an out of bounds index returns
i+1
, but:Somewhat more concerning, these cases actually happen a bunch during the test suite, but get suppressed by
@inbounds
, which is not how that functionality is supposed to be used.We should figure out what this function does and adjust implementations accordingly.
The text was updated successfully, but these errors were encountered: