-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Bugfix] Add check to avoid calling back() on an empty container #8930
Conversation
Thanks @syang-ng , can you add a regression unit test case to cover the problem(ideally not calling build but directly call the pass that invokes this function)? |
cc @ZihengJiang @vinx13 please help to manage the PR |
I add a test case to cover the problem in the new commit. Since there is no way to invoke this function directly, I call the pass |
please fix ci error |
7e78ef9
to
583a646
Compare
43ceb11
to
e746ce6
Compare
I updated the test case and it has passed all checks. Could you help to review it? Thanks :-P @vinx13 |
…che#8930) * fix bug of calling back() on an empty container scope_[op->buffer_var.get()] * add test case for ConvertSSA * update the style to fix ci error * add annotation for function test_convert_ssa * update the style of test_convert_ssa to fix ci error
…che#8930) * fix bug of calling back() on an empty container scope_[op->buffer_var.get()] * add test case for ConvertSSA * update the style to fix ci error * add annotation for function test_convert_ssa * update the style of test_convert_ssa to fix ci error
This is related to an issue here.
In a word, function
PrimExpr VisitExpr_(const LoadNode* op)
forgets to check the size of the vectorscope_[op->buffer_var.get()]
, while calling std::vector::back on an empty container will cause undefined behavior.This PR fixed this problem by adding the vector size check before calling
back()
.To reproduce the bug: