diff options
Diffstat (limited to 'validation/enum-bounds.c')
| -rw-r--r-- | validation/enum-bounds.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/validation/enum-bounds.c b/validation/enum-bounds.c new file mode 100644 index 00000000..604e0f33 --- /dev/null +++ b/validation/enum-bounds.c @@ -0,0 +1,25 @@ +enum bound_int_max { + IMAX = __INT_MAX__, +}; +_Static_assert([typeof(IMAX)] == [int], ""); + +enum bound_int_maxp1 { + IMP1 = __INT_MAX__ + 1L, +}; +_Static_assert([typeof(IMP1)] == [unsigned int], ""); + +enum bound_int_maxm1 { + IMM1 = -__INT_MAX__ - 1L, +}; +_Static_assert([typeof(IMM1)] == [int], ""); + +enum bound_int_maxm2 { + IMM2 = -__INT_MAX__ - 2L, +}; +_Static_assert([typeof(IMM2)] == [long], ""); + +/* + * check-name: enum-bounds + * check-command: sparse -m64 $file + * check-known-to-fail + */ |
