Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang 11 upgrade: fix cast size warnings in bounds.c test #434

Open
secure-sw-dev-bot opened this issue Jan 15, 2022 · 0 comments
Open

Clang 11 upgrade: fix cast size warnings in bounds.c test #434

secure-sw-dev-bot opened this issue Jan 15, 2022 · 0 comments

Comments

@secure-sw-dev-bot
Copy link

This issue was copied from microsoft/checkedc#435


In the typechecking/bounds.c test, lines 568-578 involve casting _Array_ptr<int> types to integer types. With changes introduced in clang 11, casts to a smaller integer type result in a warning: "cast to smaller integer type 'T' from '_Array_ptr'" where T is an integer type.

// byte_count
short int t20 : byte_count(5 * sizeof(int)) = (short int)a1;
int t21 : byte_count(5 * sizeof(int)) = (int)a1;
long int t22 : byte_count(5 * sizeof(int)) = (long int)a1;
unsigned long int t23 : byte_count(5 * sizeof(int)) = (unsigned long int) a1;
enum E1 t24 : byte_count(8) = EnumVal1;

// bounds
int t25 : bounds(a1, a1 + 5) = (int)a1;
long int t26 : bounds(a1, a1 + 5) = (int)a1;
unsigned long int t27 : bounds(a1, a1 + 5) = (int)a1;
enum E1 t28 : bounds(a1, a1 + 5) = (int)a1;

On different platforms, these integer types can have different sizes, so these tests should expect the "cast to smaller integer type" warning only on certain platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant