From patchwork Wed Jan 31 08:35:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 194579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1750213dyb; Wed, 31 Jan 2024 00:39:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IGk+6C4zH6zzsePF9nf+ZeLTRTI4QdDYeEthH2glDNzqi+yf8G9uM9l5iNTSiKvuUnGBOVr X-Received: by 2002:a05:620a:15b8:b0:783:f8b4:1662 with SMTP id f24-20020a05620a15b800b00783f8b41662mr831510qkk.14.1706690392959; Wed, 31 Jan 2024 00:39:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706690392; cv=pass; d=google.com; s=arc-20160816; b=rHRJSvgYYRKcz61QfpEkPQgnCJitJp8CEf6cpZwT5kCcMqrb39MR/3ApFNdTmB5/sH AVHOdLUCxE+GSBTKJLmp0u6cuYikGOuxyQ8e3JIvS83k4CEV9op9bKHxl+Fl8mcGsCmp z7OgkfFSAZ0888YvKzKJcp8e1q6QBqxKVjwd+NZwViDU0gBTHwFr2RhQZ3CVF4z/lM/w tLfbo8KqczgHkNNFceS380Hu02JCdaSqDEbKvTdg1FQgUepe0dFTgZ8QgGHCpneEAjVI ZiRfgD8zn4+x491sxPbGpuBIed/K1nVsGrvww9gpaM2sLnhODFE9QmfCUPYjygC/5dk7 yHiQ== 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=CaTjVoeeZkupbgU8WLdo7PECJcb6yrJZd+NqwLkUEBg=; fh=nY1wUSNsGESm4kaC70yUkcTyLAvut2NU6UHns8ptYvM=; b=uIj7kBkhLQxehdG0F0LDz5kk1mj2iGcbyfODEcXeTnwyJpXgHsgSOqkV/7cOJOiuFt jksnum3cojDhvVoTacSbgtkaj+e3RsNH/i7nJl93cVEbeSrcd4Jv0JXdmk6bHt6iQPyM e8oreFalwKz5gUoQ7J5DyzCxnOegqaql6nCqyXQ+7Qf8G8MKgzsQp7vTC46me2kUoQDv TtvClirdXawBvN/K8qst40Sx6P2XhrZJ63DYexxXZD5OEixHeft+Kg/73gAfjR5wTUf1 tazKgGGZn9y8cBD9UVBmbEA08c9kL5Uu5Xhunmn8M+Uh/JCvh/P8uOWtsBSeDl8xW2Kk 2afA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iMnstpc+; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 X-Forwarded-Encrypted: i=1; AJvYcCX+K6ioAihqR4OwBNt9AyROD/V27k9CUdA0LbM54dEvhKa18LUs2EKNbNfaiuUF0JH2OMhfYhCrPgewdSleDvleelemhA== Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id m14-20020ae9e70e000000b0078396c408c5si11785161qka.74.2024.01.31.00.39.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:39:52 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iMnstpc+; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 564413858C29 for ; Wed, 31 Jan 2024 08:39:52 +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 CBDD4385840D for ; Wed, 31 Jan 2024 08:35:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CBDD4385840D 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 CBDD4385840D 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=1706690153; cv=none; b=dPZCENK/5cFLcnUQy42+oxJPlGMF70kAT67vWeweSR1jpekgCoevwb7nJv6M2Zl3WwizM9YDBWvdBepnYOyCkiA0bdq8+LssLLrKfbf3CUQ7vdnOZe3Misu/S0iNuwzLUVMqT4vmgn02ikYk0aP6g5ri1VthnjutsyVbAoHqrzQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706690153; c=relaxed/simple; bh=Z9XxoJwjXdW9fj0h53J2qJrF2vRJu/zEDZ4o7+38VPg=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=tRvvQkP9/FGAHB0cWOH19dptc7K2BmY09mQ60lmbBObc5hWb0sQafK+D/JB97Blq+x+zPjmSc/xFF1FVZzu1898vYH9NE/jXHwBza0ZK1IRxjfQ1/CPt2Q2h0GxQwNOsArvqi5we+xS1fHx6Rwvu3EGwBjaWC09aZZr6oXvBQCs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706690142; 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=CaTjVoeeZkupbgU8WLdo7PECJcb6yrJZd+NqwLkUEBg=; b=iMnstpc+BmiFMVqSWP3qzVyFQJhezUm5mmzuYpE5eAbhflO/qEzvfsQLIPqgJDysxg0Ftp E4y68O/vdQ3TdbHEmQG1fUTtPc/MHd7eoESflWqhQDVmP/nhWjAwBbjccan9bme0RrdniI n9L9nZth/v2V4DcU9OrAZkLMX6tAwCg= 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-379-n7rVMToUM62JmpbJXc1xjA-1; Wed, 31 Jan 2024 03:35:39 -0500 X-MC-Unique: n7rVMToUM62JmpbJXc1xjA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 D00DC3C2E0A8; Wed, 31 Jan 2024 08:35:38 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 91AC3C2590D; Wed, 31 Jan 2024 08:35:38 +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 40V8ZaoR266996 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 31 Jan 2024 09:35:36 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40V8ZZA7266995; Wed, 31 Jan 2024 09:35:35 +0100 Date: Wed, 31 Jan 2024 09:35:35 +0100 From: Jakub Jelinek To: Richard Biener , Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] dwarf2out: Fix ICE on large _BitInt in loc_list_from_tree_1 [PR113637] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.3 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: 1789594585133769533 X-GMAIL-MSGID: 1789594585133769533 Hi! This spot uses SCALAR_INT_TYPE_MODE which obviously ICEs for large/huge BITINT_TYPE types which have BLKmode. But such large BITINT_TYPEs certainly don't fit into DWARF2_ADDR_SIZE either, so we can just assume it would be false if type has BLKmode. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-01-31 Jakub Jelinek PR debug/113637 * dwarf2out.cc (loc_list_from_tree_1): Assume integral types with BLKmode are larger than DWARF2_ADDR_SIZE. * gcc.dg/bitint-80.c: New test. Jakub --- gcc/dwarf2out.cc.jj 2024-01-24 13:11:21.132468150 +0100 +++ gcc/dwarf2out.cc 2024-01-30 17:23:41.249054946 +0100 @@ -19027,6 +19027,7 @@ loc_list_from_tree_1 (tree loc, int want && ! DECL_IGNORED_P (loc) && (INTEGRAL_TYPE_P (TREE_TYPE (loc)) || POINTER_TYPE_P (TREE_TYPE (loc))) + && TYPE_MODE (TREE_TYPE (loc)) != BLKmode && (GET_MODE_SIZE (SCALAR_INT_TYPE_MODE (TREE_TYPE (loc))) <= DWARF2_ADDR_SIZE)) { --- gcc/testsuite/gcc.dg/bitint-80.c.jj 2024-01-30 17:30:02.843696120 +0100 +++ gcc/testsuite/gcc.dg/bitint-80.c 2024-01-30 17:32:33.301583203 +0100 @@ -0,0 +1,15 @@ +/* PR debug/113637 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-g -std=c23" } */ + +#if __BITINT_MAXWIDTH__ >= 639 +typedef _BitInt(639) B; +#else +typedef _BitInt(63) B; +#endif + +void +foo (B n) +{ + extern void bar (int [][n]); +}