From patchwork Thu Dec 7 07:51:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 174982 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp4616330vqy; Wed, 6 Dec 2023 23:52:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHgnCHhWS1zA9zC/ge0fAasi4USN0xyqORfrWuCKlOQL2JXoqe+RjBR9rFSoZ8VdHnyknpp X-Received: by 2002:ac8:58d2:0:b0:423:763d:cbd5 with SMTP id u18-20020ac858d2000000b00423763dcbd5mr2733933qta.33.1701935525711; Wed, 06 Dec 2023 23:52:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701935525; cv=pass; d=google.com; s=arc-20160816; b=WqbZ8OQWf6xrZpr5j3Ixr3rd1KTeDBKmlVfoAN+E09UEMEGfVsp5+mZl7l93cBoAiA tv6gxhStbEIGOvSAj1bXnNLBCwFxMX99iTn+H39WteuyNVoH/i2tiMq7N/Rxxfmfe8yd bkqYX+mYIAqJ8m9STd++9bdggfW0oVzPlt0FKS+NtuMu7rx20esCzVZxFBIvRIg6m+3h t9E4EnzGZbOlihH3KqQgkC9dsfhgJLcALbcExZM4XLl46oDUbv+tXqRlXhQhw/Tz39h5 /9DnDiRqp6yQA3FkAy8773ZIOPhyGpQCkQpzs1WJjCSSunOtpQJoZ98E+TXsu2u4cwyN pMQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=Xg24ZxuSKidf+yFCFPpDOUPgF3Be52RrtRql1zvnFj8=; fh=FCjeRajqaQYHMkQtfIia8KT5yBac53mYOLLyJhYG/AY=; b=Bj2ZXc5xjmQNjRJKxgSmQAGL7EJfTlLvMAODaOJUZk5E19Vu3NchuCcf72zHTCaxk7 /yfqq0WCHJHeVvk7+o8vjONEHWwLmbv2+jxvm4bX72GyO7lcb8Zi4b2P5io84j0l+bPY Yd264C16X7l1sAscs0ImOSF9iHtvkZVsVcWqynsZGGCPNrqTKdqBRDt9XT15FynARphZ 4C7TKHei9zb8dlyDwICBs7zFhwite248a9LLfaJw+q/5zlnaG4cYnc1iFASE8VT+krUD jCEcZEe6xiB5hN4lpsXk0mEyo5BbevR2/lP0BUUc5arwbzgW1T5Nfn41ufjZne3JwlMP bqzg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Mu7HNVrA; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id k3-20020ac80743000000b00425469c40d8si728295qth.725.2023.12.06.23.52.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 23:52:05 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Mu7HNVrA; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4B25C385DC0B for ; Thu, 7 Dec 2023 07:52:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 520EF3858C56 for ; Thu, 7 Dec 2023 07:51:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 520EF3858C56 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 520EF3858C56 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701935503; cv=none; b=aJgIUA5ts5RGTcqvjegnigwn0JOYaLT0M1A59MO0MJ5obY1Xw5IgZhBjsHjfScf97qgvLRCsBV7Ko317GIk6JtI48uP704yPDW0ZKQ4PnI2ew2mtIEg2P4QlugSo+TqSNDVq3Snlfi5cGSyp3vdyt5qqKa5k0BSjEyobOr3woRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701935503; c=relaxed/simple; bh=zvsux6uRpmC1Xw/40otSCEKvXtEUB7et6eg6SeFpGLA=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=plzf0RUO6Vb+6oOcu7ua2PyQtZXRL7vqZmc0cjfjj4DF8uTOy/TDKNFGEfj/OmCktk5LKpRgD1vB/vSv6MX+jpt2VLBXbVjGvH7vFHMSxUJ/lD+ikv4SEgzhb3sWAfUil3uBmyd1dlELaXjACrcb9v7L1eds+CsrIGZi9zTFyio= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701935501; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=Xg24ZxuSKidf+yFCFPpDOUPgF3Be52RrtRql1zvnFj8=; b=Mu7HNVrA6YBNll2kc5D4oablCnBifiLWGvUSH9PpG12qoPUkJmVH43sRerBMFERp4pKHgj lAsrNj4H4fgu2y3rOZ7KeByZ9y2WWvXzIeB4Fdm50IoSPa1+R0raflK58vInWDislwA8IT VpX/zgHhfQl09fhWn1CZ1N/bYOiKXQc= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-539-ocbX6CHiP_WrrljKvtCiog-1; Thu, 07 Dec 2023 02:51:39 -0500 X-MC-Unique: ocbX6CHiP_WrrljKvtCiog-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 935523C2865B; Thu, 7 Dec 2023 07:51:39 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.195.157]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 578D83C2E; Thu, 7 Dec 2023 07:51:39 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 3B77paHf161617 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 7 Dec 2023 08:51:37 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3B77pai6161612; Thu, 7 Dec 2023 08:51:36 +0100 Date: Thu, 7 Dec 2023 08:51:36 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] expr: Handle BITINT_TYPE in count_type_elements [PR112881] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784608745796000621 X-GMAIL-MSGID: 1784608745796000621 Hi! The following testcaser ICEs during gimplification, because count_type_elements doesn't handle BITINT_TYPE. It should handle it like other integral types. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2023-12-07 Jakub Jelinek PR middle-end/112881 * expr.cc (count_type_elements): Handle BITINT_TYPE like INTEGER_TYPE. * gcc.dg/bitint-50.c: New test. Jakub --- gcc/expr.cc.jj 2023-12-01 08:10:43.037319912 +0100 +++ gcc/expr.cc 2023-12-06 17:36:15.437408307 +0100 @@ -7021,6 +7021,7 @@ count_type_elements (const_tree type, bo case REFERENCE_TYPE: case NULLPTR_TYPE: case OPAQUE_TYPE: + case BITINT_TYPE: return 1; case ERROR_MARK: --- gcc/testsuite/gcc.dg/bitint-50.c.jj 2023-12-06 17:37:15.502565091 +0100 +++ gcc/testsuite/gcc.dg/bitint-50.c 2023-12-06 17:36:48.866939013 +0100 @@ -0,0 +1,21 @@ +/* PR middle-end/112881 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-O2 -std=c23" } */ + +struct S { _BitInt(64) b; }; + +struct S +foo (_BitInt(64) p) +{ + return (struct S) { p }; +} + +#if __BITINT_MAXWIDTH__ >= 3924 +struct T { _BitInt(3924) b; }; + +struct T +bar (_BitInt(3924) p) +{ + return (struct T) { p }; +} +#endif