You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR checks that the inferred bounds of a return value expression imply the declared return bounds (if any) for the enclosing function.
This PR does not check modifications to variables or other lvalue expressions that are used in return bounds. For example:
_Array_ptr<int> f(int size) : count(size) {
size = 3; // modify the size variable used in the declared return bounds
return 0;
}
At the assignment size = 3, the bounds checker will not emit any diagnostic messages even though the modified variable size is used in the declared return bounds. This can be done in a separate PR.
CheckedC/dump-dataflow-facts.c: two functions returned expressions with invalid bounds. These functions now return 0.
CheckedC/static-checking/bounds-decl-checking.c: four functions returned expressions with invalid bounds. These functions now return expressions with valid bounds.
CheckedC/static-checking/return-bounds.c: add a new test file that tests the return bounds checking behavior introduced in this PR.
checkedc/465: add expected errors to thirteen function in checkedc tests that return expressions with invalid bounds.
checkedc-llvm-test-suite/114: update one function in the LLVM test suite that returned an expression with unknown bounds.
This issue was copied from checkedc/checkedc-clang#1150
This PR checks that the inferred bounds of a return value expression imply the declared return bounds (if any) for the enclosing function.
This PR does not check modifications to variables or other lvalue expressions that are used in return bounds. For example:
At the assignment
size = 3, the bounds checker will not emit any diagnostic messages even though the modified variablesizeis used in the declared return bounds. This can be done in a separate PR.Test updates:
strand&str[0]#1147).