Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

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 checkedc/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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant