From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OE5tCY1O5mqeZSQAWB0awg (envelope-from ) for ; Sat, 31 Oct 2026 16:24:45 -0400 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=yKOR/qVx; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 11A92378002; Sat, 31 Oct 2026 16:24:45 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 14A83378002 for ; Sat, 31 Oct 2026 16:24:44 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 08AC54BAE7F9 for ; Sat, 31 Oct 2026 20:24:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 08AC54BAE7F9 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=yKOR/qVx Received: from omta40.uswest2.a.cloudfilter.net (omta40.uswest2.a.cloudfilter.net [35.89.44.39]) by sourceware.org (Postfix) with ESMTPS id EC3004BA2E22 for ; Sat, 31 Oct 2026 20:24:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EC3004BA2E22 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EC3004BA2E22 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=35.89.44.39 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793478256; cv=none; b=NH3oR4Lbakv4DfbRiNBa5uVFyCOi6b9jdWpdbJ1fAZJ+H3rerLLlxI1OQ7lJe2Zwf/3HAJAc+Xck8oXbT8ebnP9P5VB5bIKK2ukVRHwVU2lo6ArnLF1gnzbndYOAED5msxURXZgnB5AlOuSUhJLJDAn0emx29V+gapMRaByO97s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1793478256; c=relaxed/simple; bh=1mx5l+86sXTDm8ocCni/lecFwJyEQGjLfPKYChx5cEs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=D++qYeHf7pcHPR5c0FM9McCU9ott4S3aA8OLz9+4Q5ovyD0StlTysoaHJhVzDGXmSp+M/8xV3oPyf6QPIp7pQdRFwx9hBaIdW+nTwABzoAcCIZZZSh/FkeKEUT7GyAVQt48bIfpT2ZlzpSTZZudmK1Cd6DW7v5QsgnNKdIN5OLI= ARC-Authentication-Results: i=1; sourceware.org; dkim=policy (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=yKOR/qVx reason="signing key too small" DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC3004BA2E22 Received: from eig-obgw-6007b.ext.cloudfilter.net ([10.0.30.166]) by cmsmtp with ESMTPS id NF1hxZlRJc3XsNFccxK8e7; Sat, 31 Oct 2026 20:24:14 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id NFcbxLasrkE4RNFcbxxyj0; Sat, 31 Oct 2026 20:24:13 +0000 X-Authority-Analysis: v=2.4 cv=LuaSymdc c=1 sm=1 tr=0 ts=6ae64e6d a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=660iZSQnnn4A:10 a=ItBw4LHWJt0A:10 a=CCpqsmhAAAAA:8 a=umKGCJxWBAp1W87rgRwA:9 a=ul9cdbp4aOFLsgKbc677:22 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+YYsc61k/cPp1Zxqq3Ej19NkhqYeSCP2xrbQfEAvBT0=; b=yKOR/qVxylCnoKk/E6vq7yAjRQ 95Ozxsw31H4hwAW0/xUugs4Qx/m8eleVaJ9YR/LPCow0K6P3HzG+K0EJ/8nCuYheGByanUjqErJQ8 m1TbzPvZdKgH+C0DEcjgHqncW; Received: from 97-122-110-129.hlrn.qwest.net ([97.122.110.129]:40078 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xNFca-00000003yW1-42zi; Sat, 31 Oct 2026 14:24:13 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Fix Rust unsized2.exp failures with newer Rust compiler Date: Sat, 31 Oct 2026 14:24:05 -0600 Message-ID: <20261031202405.4002049-1-tom@tromey.com> X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.110.129 X-Source-L: No X-Exim-ID: 1xNFca-00000003yW1-42zi X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-110-129.hlrn.qwest.net (localhost.localdomain) [97.122.110.129]:40078 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfKi8r3Y4DFWSladLtPCQCID6XDHR/iHAxwoqy76xH9ZVBhPgmbjS6wKisru6/h+c/VaxxysVjIsU3ZGahp5uE9rWCu7bM9CMK/qB8yeqK+sC/umX+nAv LaGqfc5SfKK3C0YdQnfYQJJ0nT3iDqu2/cT4gVv8OHsJbWnAmpPez7z5MUBsFTC9+QfCP149I0zKehIKLuEJC8P1T/PhM+9dxLw= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Newer versions of the Rust compiler changed to emit an array type as the trailing type of an unsized object. That is, now they look somewhat like a struct using the C "struct hack". Previously, this trailing field was emitted using the element type. This change caused some gdb failures in gdb.rust/unsized2.exp. This patch fixes the problem. It uses a heuristic to decide which type to use. I believe the heuristic should work because any possibly concrete array type in the final slot here should have a length. I tested this with rustc 1.61 (minimum version for unsized2.exp, uses the element type) and rustc 1.99 (has the fix, uses an array type). I don't know precisely which version of rustc introduced the fix; it seemed like a pain to find out and I don't think it matters. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34344 --- gdb/rust-lang.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 9c2a4c4c811..9b62cf8b687 100644 --- a/gdb/rust-lang.c +++ b/gdb/rust-lang.c @@ -302,7 +302,17 @@ rewrite_slice_type (struct type *in_type, struct type **new_type, { if (additional_length == nullptr) return true; - rewritten = lookup_array_range_type (field_type, 0, bound); + /* Rust changed to emit an array type here. This is an + improvement, but it puts gdb in a bind, because which variant + is in use isn't readily knowable here. We use the heuristic + that if the trailing member is an array without an upper + bound, then it is "new style". */ + if (field_type->code () == TYPE_CODE_ARRAY + && field_type->bounds ()->high.kind () == PROP_UNDEFINED) + rewritten = lookup_array_range_type (field_type->target_type (), + 0, bound); + else + rewritten = lookup_array_range_type (field_type, 0, bound); *additional_length = rewritten->length (); } else -- 2.49.0