Closed
Description
This issue was copied from checkedc/checkedc-clang#893
- In bounds checking related diagnostic messages, highlight the assignment within a top-level statement that causes the error or warning. This PR considers two types of bounds checking error messages for a variable V:
- The compiler cannot prove or can disprove the declared bounds for V are valid after an assignment to a variable in the bounds of V; and
- The inferred bounds of V become unknown after an assignment to a variable used in the declared bounds for V.
- Print 'assignment', 'increment', 'decrement' or 'initialization' in the error message depending on the "type" of the target expression.
An example
array_ptr<int> p : count(len) = ...;
other = 0, len = len * 2;
Error message before the change (highlight the whole statement):
error: inferred bounds for 'p' are unknown after statement
other = 0, len = len * 2;
^~~~~~~~~~~~~~~~~~~~~~~~~
After the change (blame the embedded assignment that caused the error; print 'assignment' instead of 'statement'):
error: inferred bounds for 'p' are unknown after assignment
other = 0, len = len * 2;
^~~~~~~~~~~~~
Metadata
Metadata
Assignees
Labels
No labels