Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A few fixes for non-returning function analysis
1. We determine cycle by only checking the number delayed frames. Change it to check whether the set of delayed frames stays the same. This change may not be necessary, but it is safer 2. Enforce the correct order for checking function status when dealing with tail calls and shared code. The common code is moved to a new function Parser::update_function_ret_status. The return status starts with UNSET, and increases to RETURN, and maybe NORETURN Once it is RETURN or NORETURN, it will not go back to UNSET. Therefore, it is crucial for the following if statements to be the right order: First check the smaller values, and then check the larger values. Consider that if we reverse the order. So the code looks like 1) if (other_func->retstatus() == RETURN) { .... 2) } else if (other_func->retstatus() == UNSET) { .... } In such code structure, at line 1), the other_func can be in UNSET, so the check fails. Concurrently, the other_func can be immediately set to RETURN, making the check at line 2) failing. So, the frame.func is neither delayed, nor updates its return status to RETURN, which can lead to wrong NORETURN status.
- Loading branch information
Showing
2 changed files
with
40 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters