Hi! The following patch (on top of the stdckdint.h patch and _BitInt patch series) adds a test for _BitInt diagnostics of ckd_{add,sub,mul} macros.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2023-08-10 Jakub Jelinek <ja...@redhat.com> * gcc.dg/stdckdint-3.c: New test. --- gcc/testsuite/gcc.dg/stdckdint-3.c.jj 2023-08-10 13:02:10.520431079 +0200 +++ gcc/testsuite/gcc.dg/stdckdint-3.c 2023-08-10 13:03:41.352129959 +0200 @@ -0,0 +1,21 @@ +/* Test C23 Checked Integer Arithmetic macros in <stdckdint.h>. */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-std=c2x" } */ + +#include <stdckdint.h> + +int +main () +{ + _BitInt(32) a; + int b; + ckd_add (&a, 1, 1); /* { dg-error "types used in ckd_add should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_sub (&a, 1, 1); /* { dg-error "types used in ckd_sub should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_mul (&a, 1, 1); /* { dg-error "types used in ckd_mul should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_add (&b, 1wb, 1); /* { dg-error "types used in ckd_add should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_sub (&b, 1wb, 1); /* { dg-error "types used in ckd_sub should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_mul (&b, 1wb, 1); /* { dg-error "types used in ckd_mul should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_add (&b, 1, 1wb); /* { dg-error "types used in ckd_add should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_sub (&b, 1, 1wb); /* { dg-error "types used in ckd_sub should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ + ckd_mul (&b, 1, 1wb); /* { dg-error "types used in ckd_mul should be integral other than plain char, bool, bit-precise integer or enumerated type" } */ +} Jakub