{"id":2228776,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2228776/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/ae9FqvLnAgGgE4UL@tucnak/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<ae9FqvLnAgGgE4UL@tucnak>","date":"2026-04-27T11:16:58","name":"c, middle-end: Implement C2Y N3747 paper - Integer Sets, v5","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"1743c5f7ccc9612dea00bbabf2a7d5251392bc4f","submitter":{"id":671,"url":"http://patchwork.ozlabs.org/api/1.1/people/671/?format=json","name":"Jakub Jelinek","email":"jakub@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/ae9FqvLnAgGgE4UL@tucnak/mbox/","series":[{"id":501626,"url":"http://patchwork.ozlabs.org/api/1.1/series/501626/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=501626","date":"2026-04-27T11:16:58","name":"c, middle-end: Implement C2Y N3747 paper - Integer Sets, v5","version":1,"mbox":"http://patchwork.ozlabs.org/series/501626/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2228776/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2228776/checks/","tags":{},"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=cSx17k4v;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=cSx17k4v","sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com","sourceware.org; spf=pass smtp.mailfrom=redhat.com","server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.129.124"],"Received":["from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g41J859l3z1yHv\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 21:17:43 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 1189A4B9DB77\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 27 Apr 2026 11:17:36 +0000 (GMT)","from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 5F9F14B9DB59\n for <gcc-patches@gcc.gnu.org>; Mon, 27 Apr 2026 11:17:05 +0000 (GMT)","from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-643-5_BL0AUbNhqxZpknB7GkBA-1; Mon,\n 27 Apr 2026 07:17:03 -0400","from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 7E8AA1956048; Mon, 27 Apr 2026 11:17:02 +0000 (UTC)","from tucnak.zalov.cz (unknown [10.44.34.21])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n ESMTPS\n id E670E196B8F6; Mon, 27 Apr 2026 11:17:01 +0000 (UTC)","from tucnak.zalov.cz (localhost [127.0.0.1])\n by tucnak.zalov.cz (8.18.1/8.18.1) with ESMTPS id 63RBGxRL1381796\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Mon, 27 Apr 2026 13:16:59 +0200","(from jakub@localhost)\n by tucnak.zalov.cz (8.18.1/8.18.1/Submit) id 63RBGwLq1381795;\n Mon, 27 Apr 2026 13:16:58 +0200"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 1189A4B9DB77","OpenDKIM Filter v2.11.0 sourceware.org 5F9F14B9DB59"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 5F9F14B9DB59","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 5F9F14B9DB59","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777288625; cv=none;\n b=nUxwZpv76pdT8RYu8/KlryY0IuBSG7JT4v2luWNpc3Qvn5GijEckm+KvIS3uuQU98dxZRhVyFoqSXUv4RVCRafS/mCcBhkY0B4yOqSzf6/6QpOWxMnq5vDgOi8ihA+3laALacm0rNkBVgq7ND76gt9MR5AWK2hTjncTQek+vCXI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777288625; c=relaxed/simple;\n bh=3vhmf/dRv9YjjWpJSVYjuhTZpZ/8PEjjkTvvYTI6ayI=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=EIaA4JTlVV7E3rgW0U27UYpzQVOdE2w/earQ/HJGMH8wky6dGdGEF22Shv1i7e2lPtyED2xiTqOHTL46ENeO8cs5nEdfMO2Uip2hux5P6jVDwjtxXbwhEb6bL3d/aQDG23Y7AAVhSM7k4yX2mTcHM/YzqEE7421ILcGJOfvEN60=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1777288625;\n h=from:from:reply-to:reply-to:subject:subject:date:date:\n message-id:message-id:to:to:cc:cc:mime-version:mime-version:\n content-type:content-type; bh=1Z/F3RpKDO4hmGNSIOkvky9Y/rvreuh+T5fblHb2Rpk=;\n b=cSx17k4vukIn9Y5108QO+P5ZaWADL+7rZwivog+5CuHXaXhv1FWZxk7WmzR3DMFukhkTpr\n vYGZLPKgt2Tu2nZaZOE3z6gfaiK/PJh1HNjmbJMfeJXtjmCTAOCWrQ6qmVgj7YvDo3mSQL\n o4z0c7BhXEavzgMXoIvlaRcYC6pc0+o=","X-MC-Unique":"5_BL0AUbNhqxZpknB7GkBA-1","X-Mimecast-MFC-AGG-ID":"5_BL0AUbNhqxZpknB7GkBA_1777288622","Date":"Mon, 27 Apr 2026 13:16:58 +0200","From":"Jakub Jelinek <jakub@redhat.com>","To":"\"Joseph S. Myers\" <josmyers@redhat.com>,\n Richard Biener <rguenther@suse.de>","Cc":"gcc-patches@gcc.gnu.org","Subject":"[PATCH] c, middle-end: Implement C2Y N3747 paper - Integer Sets, v5","Message-ID":"<ae9FqvLnAgGgE4UL@tucnak>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.17","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"o-2E1x6VrWGwhIVg3eyEApDZFxK1Otfvuu6jalh6NVA_1777288622","X-Mimecast-Originator":"redhat.com","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Reply-To":"Jakub Jelinek <jakub@redhat.com>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"Hi!\n\nC23 disallowed signed _BitInt(1), it only allowed unsigned _BitInt(1)\nand signed _BitInt(2) and larger precisions.\nThe https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3747.pdf paper\nchanges this for C2Y and allows signed _BitInt(1) and (backwards\nincompatibly) changes the type of 0wb from _BitInt(2) to _BitInt(1),\nall other literals keep their earlier types.  The paper contains large\nredesign of the C types hierarchy, but my understanding is that only\nthose two changes are changing something for users.\n\nBootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?\n\n2026-04-27  Jakub Jelinek  <jakub@redhat.com>\n\ngcc/\n\t* tree.cc (build_bitint_type): Allow build_bitint_type (1, 0).\n\t(signed_or_unsigned_type_for): Call that for !unsignedp case\n\tof BITINT_TYPE with bits 1.\ngcc/c-family/\n\t* c-common.cc (c_common_signed_or_unsigned_type): Use\n\tbuild_bitint_type for TREE_CODE (type) == BITINT_TYPE whenever\n\tflag_isoc2y even when precision is 1.\n\t(c_common_get_alias_set): Don't special case BITINT_TYPE\n\twith precision 1 for flag_isoc2y.\n\t* c-lex.cc (interpret_integer): Use _BitInt(1) type for 0wb\n\tif flag_isoc2y, rather than _BitInt(2).\ngcc/c/\n\t* c-decl.cc (finish_declspecs) <case cts_bitint>: Implement\n\tC2Y N3747 - Integer Sets, v5.  Allow signed _BitInt(1) for\n\tflag_isoc2y.\ngcc/testsuite/\n\t* gcc.dg/torture/bitint-96.c: New test.\n\t* gcc.dg/torture/bitint-97.c: New test.\n\t* gcc.dg/torture/bitint-98.c: New test.\n\t* gcc.dg/bitint-130.c: New test.\n\t* gcc.dg/bitint-131.c: New test.\n\t* gcc.dg/bitint-132.c: New test.\n\n\n\tJakub","diff":"--- gcc/tree.cc.jj\t2026-04-27 10:53:47.068600947 +0200\n+++ gcc/tree.cc\t2026-04-27 11:10:16.282399507 +0200\n@@ -7421,7 +7421,7 @@ build_bitint_type (unsigned HOST_WIDE_IN\n {\n   tree itype, ret;\n \n-  gcc_checking_assert (precision >= 1 + !unsignedp);\n+  gcc_checking_assert (precision >= 1);\n \n   if (unsignedp)\n     unsignedp = MAX_INT_CACHED_PREC + 1;\n@@ -11440,7 +11440,7 @@ signed_or_unsigned_type_for (int unsigne\n   else\n     return NULL_TREE;\n \n-  if (TREE_CODE (type) == BITINT_TYPE && (unsignedp || bits > 1))\n+  if (TREE_CODE (type) == BITINT_TYPE)\n     return build_bitint_type (bits, unsignedp);\n   return build_nonstandard_integer_type (bits, unsignedp);\n }\n--- gcc/c-family/c-common.cc.jj\t2026-04-27 10:53:47.064601016 +0200\n+++ gcc/c-family/c-common.cc\t2026-04-27 11:10:16.278526205 +0200\n@@ -2819,8 +2819,8 @@ c_common_signed_or_unsigned_type (int un\n     return type;\n \n   if (TREE_CODE (type) == BITINT_TYPE\n-      /* signed _BitInt(1) is invalid, avoid creating that.  */\n-      && (unsignedp || TYPE_PRECISION (type) > 1))\n+      /* signed _BitInt(1) is invalid before C2Y, avoid creating that.  */\n+      && (unsignedp || flag_isoc2y || TYPE_PRECISION (type) > 1))\n     return build_bitint_type (TYPE_PRECISION (type), unsignedp);\n \n #define TYPE_OK(node)\t\t\t\t\t\t\t    \\\n@@ -3961,8 +3961,10 @@ c_common_get_alias_set (tree t)\n \t TYPE_ALIAS_SET_KNOWN_P.  */\n       if (TYPE_UNSIGNED (t))\n \t{\n-\t  /* There is no signed _BitInt(1).  */\n-\t  if (TREE_CODE (t) == BITINT_TYPE && TYPE_PRECISION (t) == 1)\n+\t  /* There is no signed _BitInt(1) before C2Y.  */\n+\t  if (TREE_CODE (t) == BITINT_TYPE\n+\t      && !flag_isoc2y\n+\t      && TYPE_PRECISION (t) == 1)\n \t    return -1;\n \t  tree t1 = c_common_signed_type (t);\n \t  gcc_checking_assert (t != t1);\n--- gcc/c-family/c-lex.cc.jj\t2026-04-27 10:53:47.064601016 +0200\n+++ gcc/c-family/c-lex.cc\t2026-04-27 11:10:16.280324817 +0200\n@@ -1076,7 +1076,7 @@ interpret_integer (const cpp_token *toke\n \t}\n \n       prec = wi::min_precision (wval, UNSIGNED);\n-      if (prec == 0)\n+      if (prec == 0 && ((flags & CPP_N_UNSIGNED) != 0 || !flag_isoc2y))\n \tprec = 1;\n       if ((flags & CPP_N_UNSIGNED) == 0)\n \t++prec;\n--- gcc/c/c-decl.cc.jj\t2026-04-27 10:53:47.066600982 +0200\n+++ gcc/c/c-decl.cc\t2026-04-27 11:10:16.281026906 +0200\n@@ -13651,10 +13651,11 @@ finish_declspecs (struct c_declspecs *sp\n     case cts_bitint:\n       gcc_assert (!specs->long_p && !specs->short_p\n \t\t  && !specs->complex_p);\n-      if (!specs->unsigned_p && specs->u.bitint_prec == 1)\n+      if (!specs->unsigned_p && specs->u.bitint_prec == 1 && !flag_isoc2y)\n \t{\n \t  error_at (specs->locations[cdw_typespec],\n-\t\t    \"%<signed _BitInt%> argument must be at least 2\");\n+\t\t    \"%<signed _BitInt%> argument must be at least 2 \"\n+\t\t    \"before C2Y\");\n \t  specs->type = integer_type_node;\n \t  break;\n \t}\n--- gcc/testsuite/gcc.dg/torture/bitint-96.c.jj\t2026-04-27 12:05:25.442552432 +0200\n+++ gcc/testsuite/gcc.dg/torture/bitint-96.c\t2026-04-27 12:59:19.086080979 +0200\n@@ -0,0 +1,166 @@\n+/* C2Y N3747 - Integer Sets, v5 */\n+/* { dg-do compile { target bitint } } */\n+/* { dg-options \"-std=c2y -pedantic-errors\" } */\n+\n+#define expr_has_type(e, t) _Generic (e, default : 0, t : 1)\n+\n+void\n+foo ()\n+{\n+  _BitInt(1) a = (_BitInt(1)) -1;\n+  static_assert (expr_has_type (a, signed _BitInt(1)), \"\");\n+  static_assert (expr_has_type (0wb, _BitInt(1)), \"\");\n+  static_assert (expr_has_type (~0wb, _BitInt(1)), \"\");\n+  static_assert (expr_has_type (1wb, _BitInt(2)), \"\");\n+  static_assert (expr_has_type (-1wb, _BitInt(2)), \"\");\n+  static_assert (expr_has_type (2wb, _BitInt(3)), \"\");\n+  static_assert (expr_has_type (0wb + 0wb, signed _BitInt(1)), \"\");\n+  static_assert (expr_has_type (0wb + 0uwb, unsigned _BitInt(1)), \"\");\n+  static_assert (expr_has_type (0wb + 1wb, _BitInt(2)), \"\");\n+  static_assert (expr_has_type (0uwb + 0wb, unsigned _BitInt(1)), \"\");\n+  static_assert (expr_has_type (1wb + 0wb, _BitInt(2)), \"\");\n+  static_assert (0wb == 0, \"\");\n+  static_assert (~0wb == -1, \"\");\n+  static_assert (~~0wb == 0, \"\");\n+  static_assert (-1wb == -1, \"\");\n+}\n+\n+_BitInt(1) b = 0wb;\n+_BitInt(1) c = ~0wb;\n+_BitInt(1) d = 0wb;\n+\n+[[gnu::noipa]] void\n+bar (_BitInt(1) a[21], signed _BitInt(1) b[21], const _BitInt(1) c[21])\n+{\n+  a[0] = b[0] + c[0];\n+  a[1] = b[1] + c[1];\n+  a[2] = b[2] + c[2];\n+  a[3] = b[3] - c[3];\n+  a[4] = b[4] - c[4];\n+  a[5] = b[5] - c[5];\n+  a[6] = b[6] * c[6];\n+  a[7] = b[7] * c[8];\n+  a[8] = b[8] * c[8];\n+  a[9] = b[9] / c[9];\n+  a[10] = b[10] % c[10];\n+  a[11] = b[11] % c[11];\n+  a[12] = b[12] & c[12];\n+  a[13] = b[13] & c[13];\n+  a[14] = b[14] & c[14];\n+  a[15] = b[15] | c[15];\n+  a[16] = b[16] | c[16];\n+  a[17] = b[17] | c[17];\n+  a[18] = b[18] ^ c[18];\n+  a[19] = b[19] ^ c[19];\n+  a[20] = b[20] ^ c[20];\n+}\n+\n+#if __BITINT_MAXWIDTH__ >= 256\n+[[gnu::noipa]] _BitInt(256)\n+baz (_BitInt(256) x, _BitInt(1) y)\n+{\n+  return x * y;\n+}\n+#endif\n+\n+[[gnu::noipa]] void\n+qux (_BitInt(1) p[3], float q, double r, long double s)\n+{\n+  p[0] = q;\n+  p[1] = r;\n+  p[2] = s;\n+}\n+\n+[[gnu::noipa]] void\n+corge (_BitInt(1) p[2], float q[2], double r[2], long double s[2])\n+{\n+  q[0] = p[0];\n+  q[1] = p[1];\n+  r[0] = p[0];\n+  r[1] = p[1];\n+  s[0] = p[0];\n+  s[1] = p[1];\n+}\n+\n+int\n+main ()\n+{\n+  if (b != 0 || c != -1)\n+    __builtin_abort ();\n+  --b;\n+  ++c;\n+  if (b != -1 || c != 0)\n+    __builtin_abort ();\n+  b = ~b;\n+  c = ~c;\n+  if (b != 0 || c != -1)\n+    __builtin_abort ();\n+  c *= d;\n+  if (d != 0)\n+    __builtin_abort ();\n+  _BitInt(1) e[21];\n+  _BitInt(1) f[21] = {\n+    0, -1, 0,\n+    0, -1, -1,\n+    0, -1, 0,\n+    0,\n+    0, -1,\n+    0, -1, -1,\n+    0, 0, -1,\n+    0, -1, -1\n+  };\n+  signed _BitInt(1) g[21] = {\n+    0, 0, -1,\n+    0, 0, -1,\n+    0, 0, -1,\n+    -1,\n+    -1, -1,\n+    0, 0, -1,\n+    0, -1, -1,\n+    0, 0, -1\n+  }; \n+  bar (e, f, g);\n+  _BitInt(1) h[21] = {\n+    0, -1, -1,\n+    0, -1, 0,\n+    0, 0, 0,\n+    0,\n+    0, 0,\n+    0, 0, -1,\n+    0, -1, -1,\n+    0, -1, 0\n+  };\n+  for (int i = 0; i < 21; ++i)\n+    if (e[i] != h[i])\n+      __builtin_abort ();\n+#if __BITINT_MAXWIDTH__ >= 256\n+  if (baz (24807048826655379640613156875228202584070386120119745959437529938064756141700wb, ~0wb)\n+      != -24807048826655379640613156875228202584070386120119745959437529938064756141700wb)\n+    __builtin_abort ();\n+  if (baz (24807048826655379640613156875228202584070386120119745959437529938064756141700wb, 0wb) != 0wb)\n+    __builtin_abort ();\n+  if (baz (-24807048826655379640613156875228202584070386120119745959437529938064756141700wb, 0wb)\n+      != 24807048826655379640613156875228202584070386120119745959437529938064756141700wb)\n+    __builtin_abort ();\n+  if (baz (0wb, ~0wb) != 0wb)\n+    __builtin_abort ();\n+#endif\n+  qux (e, 0.5f, 0.25, 0.75L);\n+  qux (e + 3, -0.5f, -0.25, -0.75L);\n+  qux (e + 6, 0.f, 0., 0.L);\n+  qux (e + 9, -1.f, -1., -1.L);\n+  qux (e + 12, -1.5f, -1.25, -1.75L);\n+  for (int i = 0; i < 15; ++i)\n+    if (e[i] != (i < 9 ? 0 : -1))\n+      __builtin_abort ();\n+  e[0] = 0wb;\n+  e[1] = ~0wb;\n+  float j[2];\n+  double k[2];\n+  long double l[2];\n+  corge (e, j, k, l);\n+  if (j[0] != 0.0f || j[1] != -1.0f\n+      || k[0] != 0.0 || k[1] != -1.0\n+      || l[0] != 0.0L || l[1] != -1.0L)\n+    __builtin_abort ();\n+}\n--- gcc/testsuite/gcc.dg/torture/bitint-97.c.jj\t2026-04-27 12:06:44.433193774 +0200\n+++ gcc/testsuite/gcc.dg/torture/bitint-97.c\t2026-04-27 12:13:26.394282453 +0200\n@@ -0,0 +1,35 @@\n+/* C2Y N3747 - Integer Sets, v5 */\n+/* { dg-do compile { target bitint } } */\n+/* { dg-options \"-std=c2y -pedantic-errors -fwrapv\" } */\n+\n+[[gnu::noipa]] void\n+bar (_BitInt(1) a[8], signed _BitInt(1) b[8], const _BitInt(1) c[8])\n+{\n+  a[0] = b[0] + c[0];\n+  a[1] = b[1] - c[1];\n+  a[2] = b[2] / c[2];\n+  a[3] = ++b[3];\n+  a[4] = b[4]++;\n+  a[5] = --b[5];\n+  a[6] = b[6]--;\n+  a[7] = -b[7];\n+}\n+\n+int\n+main ()\n+{\n+  _BitInt(1) e[8];\n+  _BitInt(1) f[8] = {\n+    -1, 0, -1, 0, 0, -1, -1, -1,\n+  };\n+  signed _BitInt(1) g[8] = {\n+    -1, -1, -1, -1, -1, 0, 0, -1,\n+  }; \n+  bar (e, f, g);\n+  _BitInt(1) h[8] = {\n+    0, -1, -1, -1, 0, 0, -1, -1\n+  };\n+  for (int i = 0; i < 8; ++i)\n+    if (e[i] != h[i] || (i > 2 && f[i] != g[i]))\n+      __builtin_abort ();\n+}\n--- gcc/testsuite/gcc.dg/torture/bitint-98.c.jj\t2026-04-27 12:27:54.665363689 +0200\n+++ gcc/testsuite/gcc.dg/torture/bitint-98.c\t2026-04-27 12:36:36.657406546 +0200\n@@ -0,0 +1,88 @@\n+/* C2Y N3747 - Integer Sets, v5 */\n+/* { dg-do compile { target bitint } } */\n+/* { dg-options \"-std=c2y -pedantic-errors\" } */\n+/* { dg-skip-if \"\" { ! run_expensive_tests }  { \"*\" } { \"-O0\" \"-O2\" } } */\n+/* { dg-skip-if \"\" { ! run_expensive_tests } { \"-flto\" } { \"\" } } */\n+\n+#if __BITINT_MAXWIDTH__ >= 256\n+[[gnu::noipa]] bool\n+foo (_BitInt(256) x, _BitInt(256) y, _BitInt(1) *z)\n+{\n+  return __builtin_add_overflow (x, y, z);\n+}\n+\n+[[gnu::noipa]] bool\n+bar (_BitInt(256) x, _BitInt(256) y, _BitInt(1) *z)\n+{\n+  return __builtin_sub_overflow (x, y, z);\n+}\n+\n+[[gnu::noipa]] bool\n+baz (_BitInt(256) x, _BitInt(256) y, _BitInt(1) *z)\n+{\n+  return __builtin_mul_overflow (x, y, z);\n+}\n+\n+#endif\n+\n+int\n+main ()\n+{\n+#if __BITINT_MAXWIDTH__ >= 256\n+  _BitInt(1) z;\n+  if (foo (42733374111348455377695489439454828259303231857505551329091595050247393780228wb,\n+\t   -42733374111348455377695489439454828259303231857505551329091595050247393780228wb, &z)\n+      || z)\n+    __builtin_abort ();\n+  if (foo (-42733374111348455377695489439454828259303231857505551329091595050247393780228wb,\n+\t   42733374111348455377695489439454828259303231857505551329091595050247393780227wb, &z)\n+      || z != ~0wb)\n+    __builtin_abort ();\n+  if (!foo (42733374111348455377695489439454828259303231857505551329091595050247393780228wb,\n+\t    -42733374111348455377695489439454828259303231857505551329091595050247393780227wb, &z)\n+      || z != ~0wb)\n+    __builtin_abort ();\n+  if (!foo (16820456121763970532229687954276499920583743168031969051240987845040434685573wb,\n+\t    23294062539967091892447346238664352846257951403931317361440421661377004317436wb, &z)\n+      || z != ~0wb)\n+    __builtin_abort ();\n+  if (!foo (16820456121763970532229687954276499920583743168031969051240987845040434685574wb,\n+\t    23294062539967091892447346238664352846257951403931317361440421661377004317436wb, &z)\n+      || z != 0wb)\n+    __builtin_abort ();\n+  if (bar (42733374111348455377695489439454828259303231857505551329091595050247393780228wb,\n+\t   42733374111348455377695489439454828259303231857505551329091595050247393780228wb, &z)\n+      || z)\n+    __builtin_abort ();\n+  if (bar (-42733374111348455377695489439454828259303231857505551329091595050247393780228wb,\n+\t   -42733374111348455377695489439454828259303231857505551329091595050247393780227wb, &z)\n+      || z != ~0wb)\n+    __builtin_abort ();\n+  if (!bar (42733374111348455377695489439454828259303231857505551329091595050247393780228wb,\n+\t    42733374111348455377695489439454828259303231857505551329091595050247393780227wb, &z)\n+      || z != ~0wb)\n+    __builtin_abort ();\n+  if (!bar (16820456121763970532229687954276499920583743168031969051240987845040434685573wb,\n+\t    -23294062539967091892447346238664352846257951403931317361440421661377004317436wb, &z)\n+      || z != ~0wb)\n+    __builtin_abort ();\n+  if (!bar (16820456121763970532229687954276499920583743168031969051240987845040434685574wb,\n+\t    -23294062539967091892447346238664352846257951403931317361440421661377004317436wb, &z)\n+      || z != 0wb)\n+    __builtin_abort ();\n+  if (baz (0, 0, &z) || z != 0wb)\n+    __builtin_abort ();\n+  if (baz (-1, 0, &z) || z != 0wb)\n+    __builtin_abort ();\n+  if (baz (-1, 1, &z) || z != ~0wb)\n+    __builtin_abort ();\n+  if (!baz (-1, -1, &z) || z != ~0wb)\n+    __builtin_abort ();\n+  if (!baz (30448945616760427177055226753240458517982932603339745354716666930701331527103wb,\n+\t    42368953827467495356095621726856482300912964572736555031468887238137186859246wb, &z) || z != 0wb)\n+    __builtin_abort ();\n+  if (!baz (30448945616760427177055226753240458517982932603339745354716666930701331527103wb,\n+\t    -42368953827467495356095621726856482300912964572736555031468887238137186859247wb, &z) || z != ~0wb)\n+    __builtin_abort ();\n+#endif\n+}\n--- gcc/testsuite/gcc.dg/bitint-130.c.jj\t2026-04-27 12:38:42.599245580 +0200\n+++ gcc/testsuite/gcc.dg/bitint-130.c\t2026-04-27 12:57:11.232266794 +0200\n@@ -0,0 +1,52 @@\n+/* C2Y N3747 - Integer Sets, v5 */\n+/* { dg-do compile { target bitint } } */\n+/* { dg-options \"-std=c2y -pedantic-errors -O2\" } */\n+/* { dg-add-options float32 } */\n+/* { dg-add-options float64 } */\n+/* { dg-add-options float32x } */\n+/* { dg-require-effective-target float32 } */\n+/* { dg-require-effective-target float32x } */\n+/* { dg-require-effective-target float64 } */\n+\n+[[gnu::noipa]] void\n+foo (_BitInt(1) p[3], _Float32 q, _Float64 r, _Float32x s)\n+{\n+  p[0] = q;\n+  p[1] = r;\n+  p[2] = s;\n+}\n+\n+[[gnu::noipa]] void\n+bar (_BitInt(1) p[2], _Float32 q[2], _Float64 r[2], _Float32x s[2])\n+{\n+  q[0] = p[0];\n+  q[1] = p[1];\n+  r[0] = p[0];\n+  r[1] = p[1];\n+  s[0] = p[0];\n+  s[1] = p[1];\n+}\n+\n+int\n+main ()\n+{\n+  _BitInt(1) e[15];\n+  foo (e, 0.5f32, 0.25f64, 0.75f32x);\n+  foo (e + 3, -0.5f32, -0.25f64, -0.75f32x);\n+  foo (e + 6, 0.f32, 0.f64, 0.f32x);\n+  foo (e + 9, -1.f32, -1.f64, -1.f32x);\n+  foo (e + 12, -1.5f32, -1.25f64, -1.75f32x);\n+  for (int i = 0; i < 15; ++i)\n+    if (e[i] != (i < 9 ? 0 : -1))\n+      __builtin_abort ();\n+  e[0] = 0wb;\n+  e[1] = ~0wb;\n+  _Float32 j[2];\n+  _Float64 k[2];\n+  _Float32x l[2];\n+  bar (e, j, k, l);\n+  if (j[0] != 0.0f32 || j[1] != -1.0f32\n+      || k[0] != 0.0f64 || k[1] != -1.0f64\n+      || l[0] != 0.0f32x || l[1] != -1.0f32x)\n+    __builtin_abort ();\n+}\n--- gcc/testsuite/gcc.dg/bitint-131.c.jj\t2026-04-27 12:50:28.261156070 +0200\n+++ gcc/testsuite/gcc.dg/bitint-131.c\t2026-04-27 13:02:02.356289673 +0200\n@@ -0,0 +1,45 @@\n+/* C2Y N3747 - Integer Sets, v5 */\n+/* { dg-do compile { target bitint } } */\n+/* { dg-options \"-std=c2y -pedantic-errors -O2\" } */\n+/* { dg-add-options float128 } */\n+/* { dg-add-options float64x } */\n+/* { dg-require-effective-target float128 } */\n+/* { dg-require-effective-target float64x } */\n+\n+[[gnu::noipa]] void\n+foo (_BitInt(1) p[2], _Float128 q, _Float64x r)\n+{\n+  p[0] = q;\n+  p[1] = r;\n+}\n+\n+[[gnu::noipa]] void\n+bar (_BitInt(1) p[2], _Float128 q[2], _Float64x r[2])\n+{\n+  q[0] = p[0];\n+  q[1] = p[1];\n+  r[0] = p[0];\n+  r[1] = p[1];\n+}\n+\n+int\n+main ()\n+{\n+  _BitInt(1) e[10];\n+  foo (e, 0.5f128, 0.25f64x);\n+  foo (e + 2, -0.5f128, -0.25f64x);\n+  foo (e + 4, 0.f128, 0.f64x);\n+  foo (e + 6, -1.f128, -1.f64x);\n+  foo (e + 8, -1.5f128, -1.25f64x);\n+  for (int i = 0; i < 10; ++i)\n+    if (e[i] != (i < 6 ? 0 : -1))\n+      __builtin_abort ();\n+  e[0] = 0wb;\n+  e[1] = ~0wb;\n+  _Float128 j[2];\n+  _Float64x k[2];\n+  bar (e, j, k);\n+  if (j[0] != 0.0f128 || j[1] != -1.0f128\n+      || k[0] != 0.0f64x || k[1] != -1.0f64x)\n+    __builtin_abort ();\n+}\n--- gcc/testsuite/gcc.dg/bitint-132.c.jj\t2026-04-27 12:52:26.714130973 +0200\n+++ gcc/testsuite/gcc.dg/bitint-132.c\t2026-04-27 13:00:30.335862875 +0200\n@@ -0,0 +1,30 @@\n+/* C2Y N3747 - Integer Sets, v5 */\n+/* { dg-do compile { target bitint } } */\n+/* { dg-options \"-std=c2y -pedantic-errors -O2\" } */\n+/* { dg-add-options float16 } */\n+/* { dg-require-effective-target float16_runtime } */\n+\n+[[gnu::noipa]] _BitInt(1)\n+foo (_Float16 x)\n+{\n+  return x;\n+}\n+\n+[[gnu::noipa]] _Float16\n+bar (_BitInt(1) x)\n+{\n+  return x;\n+}\n+\n+int\n+main ()\n+{\n+  if (foo (0.5f16) != 0wb || foo (0.25f16) != 0wb\n+      || foo (-0.5f16) != 0wb || foo (-0.25f16) != 0wb\n+      || foo (0.f16) != 0wb || foo (-0.75f16) != 0wb\n+      || foo (-1.f16) != ~0wb || foo (-1.75f16) != ~0wb\n+      || foo (-1.5f16) != ~0wb || foo (-1.25f16) != ~0wb)\n+    __builtin_abort ();\n+  if (bar (0wb) != 0.f16 || bar (~0wb) != -1.f16)\n+    __builtin_abort ();\n+}\n","prefixes":[]}