diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 934e557dc3bb4a4d32cb59c55ea7379b5a0bdb8e..fe20bc21c926f9353c774a1be5aa64fb94018c64 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -9555,7 +9555,7 @@ finish_struct (location_t loc, tree t, tree fieldlist, tree attributes, if (width != TYPE_PRECISION (type)) { if (TREE_CODE (type) == BITINT_TYPE - && (width > 1 || TYPE_UNSIGNED (type))) + && width >= (TYPE_UNSIGNED (type) ? 1 : 2)) TREE_TYPE (field) = build_bitint_type (width, TYPE_UNSIGNED (type)); else diff --git a/gcc/testsuite/gcc.dg/bitint-85.c b/gcc/testsuite/gcc.dg/bitint-85.c new file mode 100644 index 0000000000000000000000000000000000000000..f2301cc9c5a4a52ce70bfc5adb0ac67be17e85a7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/bitint-85.c @@ -0,0 +1,5 @@ +/* PR c/113740 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-std=c23" } */ + +struct S { unsigned _BitInt(32) : 0; };