#4319 Regression test chekedint does not test ckd_mul
The file support/regression/tests/checkedint.c.in checks for ckd_add even when comparing against mul_func.
l = 1;
r = 2;
ASSERT ((mul_func (l, r) != (signed long long)l * r) == ckd_add (&result, l, r));
l = 100;
r = 200;
ASSERT ((mul_func (l, r) != (signed long long)l * r) == ckd_add (&result, l, r));
replacing ckd_add with ckd_mul generates several warnings when running the suite.
cases/checkedint/checkedint_type_unsigned_char.c:52: warning 244: pointer types incompatible
from type 'unsigned-char near* fixed'
to type 'unsigned-long-int generic* auto'
cases/checkedint/checkedint_type_unsigned_char.c:55: warning 244: pointer types incompatible
from type 'unsigned-char near* fixed'
to type 'unsigned-long-int generic* auto'
the cause of this is the extra case for unsigned long calling __ckd_mul_ulongull
#define ckd_mul(r, a, b) \
_Generic ((a), \
signed long long: __ckd_mul_unimplemented(r, a, b), \
unsigned long long: __ckd_mul_unimplemented(r, a, b), \
unsigned long: \
_Generic ((b), \
signed long long: __ckd_mul_unimplemented(r, a, b), \
unsigned long long: __ckd_mul_unimplemented(r, a, b), \
unsigned long: __ckd_mul_ulongull(r, a, b), \
default: __ckd_mul_default(r, a, b)), \
default: \
_Generic ((b), \
signed long long: __ckd_mul_unimplemented(r, a, b), \
unsigned long long: __ckd_mul_unimplemented(r, a, b), \
default: __ckd_mul_default(r, a, b))) \
Removing __ckd_mul_ulongull fixes all the issues, but I don't understand _Generic and ckd_mul to commit the change.