@@ -150,4 +150,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
# define ULLONG_WIDTH __LONG_LONG_WIDTH__
#endif
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ > 201710L
+/* C2X width and limit of _Bool. */
+# undef BOOL_MAX
+# define BOOL_MAX 1
+# undef BOOL_WIDTH
+# define BOOL_WIDTH 1
+#endif
+
#endif /* _LIMITS_H___ */
new file mode 100644
@@ -0,0 +1,13 @@
+/* Test limits for _Bool not in <limits.h> in C11. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11" } */
+
+#include <limits.h>
+
+#ifdef BOOL_MAX
+# error "unexpected BOOL_MAX"
+#endif
+
+#ifdef BOOL_WIDTH
+# error "unexpected BOOL_WIDTH"
+#endif
new file mode 100644
@@ -0,0 +1,19 @@
+/* Test limits for _Bool in <limits.h> in C2x. */
+/* { dg-do compile } */
+/* { dg-options "-std=c2x" } */
+
+#include <limits.h>
+
+#ifndef BOOL_MAX
+# error "missing BOOL_MAX"
+#endif
+
+#ifndef BOOL_WIDTH
+# error "missing BOOL_WIDTH"
+#endif
+
+/* In principle _Bool can support values wider than 1 bit, stored via
+ type punning, but this is not supported by GCC. */
+
+_Static_assert (BOOL_MAX == 1, "bad BOOL_MAX");
+_Static_assert (BOOL_WIDTH == 1, "bad BOOL_WIDTH");