Skip to content

Commit c6efb65

Browse files
authored
Feature tests for bounds-safe interface implicit type conversions. (checkedc#59)
This change adds feature tests for implicit type conversions at bounds-safe interfaces. It includes three sets of tests, corresponding to each language construct that can have a bounds-safe interface: a set for parameters with bounds-safe interfaces, a set for non-locally scoped variables with bounds-safe interfaces, and a set for members with bounds-safe interfaces. These tests match corresponding compiler changes for Checked C clang repo issue 31. For each set of tests, there are - tests for assigning (or passing) checked pointers to unchecked pointers with bounds-safe interfaces (where the referent types match) - tests for assigning or passing checked pointers to void * pointers with bounds-safe interfaces - tests for passing checked void pointers to non void * pointers with bounds-safe interfaces. These tests are expected to cause errors. - There are also tests for types involving type qualifiers, making sure that the qualifier restrictions are enforced (a pointer to non-const type can be assigned to a pointer to a const-type, but not the reverse). There are additional tests for parameters with array types. During type checking, the array types are adjusted to be pointer types. For Checked C, the bounds-safe interface types are checked array types and they are adjusted during type checking to be checked pointer types. For multi-dimensional arrays, this ends up being a little subtle. The multi-dimensional array has a bounds-safe interface type that is a checked multi-dimensional array. The checkedness propagates to the nested array types. When the checked multi-dimensional array type is adjusted to be a pointer, the result is a "checked pointer to a checked array type." There are tests for both 1-dimensional and 2-dimensional array parameters. The 2-dimensional array parameter tests check the subtleties of multi-dimensional arrays. Each multi-dimensional argument is typed as a "checked pointer to a checked array type", so if the appropriate adjustments did not happen for the bounds-safe interface type for the parameter, a type mismatch would occur.
1 parent baa6e4f commit c6efb65

File tree

1 file changed

+557
-0
lines changed

1 file changed

+557
-0
lines changed

0 commit comments

Comments
 (0)