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 assertion failure in JavascriptArray.cpp
#6846
base: master
Are you sure you want to change the base?
Fix assertion failure in JavascriptArray.cpp
#6846
Conversation
Please can you add a test case for this? |
Sure, but it seems like I’ve created a new assertion failure; I’ll have another look at this… |
Problem is, that the assertion error only occurred with extremely large arrays. |
The timeouts are on a per JS file basis - does it still timeout if this test is done in a separate file with nothing else? |
Assert(fromVal < MaxArrayLength); | ||
Assert(toVal < MaxArrayLength); | ||
Assert(direction == -1 || (fromVal + count < MaxArrayLength && toVal + count < MaxArrayLength)); | ||
Assert(direction != -1 || (fromVal < MaxArrayLength && toVal < MaxArrayLength)); | ||
Assert(fromVal + count <= MaxArrayLength && toVal + count <= MaxArrayLength); |
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.
This may be obvious, but what is going on in these asserts should be to opposite of the condition for "slower path" above (currently line 9460) which reads like "backwards and from/to large OR from+count/to+count large'. I suspect the assert that is tripping is off by one element, or maybe overflowing, not sure.
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.
Previously, it was not the logical opposite of the condition; now it should.
off by one
It used to say <
instead of <=
...
I'm in general not sure, why assert
s are used in such places at all; Why checking a condition, that is just checked above (if
)??
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.
Or do you mean, that we may need to change the if
condition itself?!
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.
Probably not, just curious why this way works. I thought the conditions in asserts are the way they because "faster path" can only handle indices within certain range.
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.
For the timeout, is there a better way to go about the test? The array copy of such size if going to be slow.
Assert(fromVal < MaxArrayLength); | ||
Assert(toVal < MaxArrayLength); | ||
Assert(direction == -1 || (fromVal + count < MaxArrayLength && toVal + count < MaxArrayLength)); | ||
Assert(direction != -1 || (fromVal < MaxArrayLength && toVal < MaxArrayLength)); | ||
Assert(fromVal + count <= MaxArrayLength && toVal + count <= MaxArrayLength); |
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.
Probably not, just curious why this way works. I thought the conditions in asserts are the way they because "faster path" can only handle indices within certain range.
Could the test complete in 3 minutes? Normally each test file gets a 1 min timeout but tests run with the If even 3 minutes is too short I don't know what to do - an Assert we can't test seems pointless. @ppenzin thoughts? |
I agree, we should try to run it as a separate test and mark as slow (given it does finish in 3 minutes). |
Fix #6770
@rhuanjl (Could you please tag this PR with
hacktoberfest-accepted
?)