Do not emit return bounds checking warnings or errors in certain contexts for bounds-safe interfaces #1157
Labels
work item
This labels issues that are not exactly bugs but are about improvements.
If we have a function whose return bounds are specified via a bounds-safe interface, e.g.
If a return statement within the body of
f
occurs within an unchecked scope and:The compiler should not emit any errors or warnings that would otherwise result from checking that the bounds of the return value imply the declared bounds of
f
.For example, in the function below,
return p
should not result in any errors even though the bounds ofp
arebounds(unknown)
.return q
should not result in any errors even though the bounds ofq
(bounds(q, q + 3)
) are too narrow for the declared bounds off
(bounds(_Return_value, _Return_value + 4)
).However, if a return statement within the body of
f
occurs within an unchecked scope and the return value has checked pointer type, the compiler should emit any errors or warnings that result from checking that the bounds of the return value imply the declared bounds off
.For example, in the function below,
return r
should result in an error since the bounds ofr
are unknown.return s
should result in an error since the bounds ofs
(bounds(s, s + 3)
) are too narrow for the declared bounds off
(bounds(_Return_value, _Return_value + 4)
).The text was updated successfully, but these errors were encountered: