From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Ey4jOqaNX2WSkA0AWB0awg (envelope-from ) for ; Thu, 23 Nov 2023 12:36:38 -0500 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=thepuzzlemaker.info header.i=@thepuzzlemaker.info header.a=rsa-sha256 header.s=default header.b=B/aKlFsi; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E01C41E0D2; Thu, 23 Nov 2023 12:36:38 -0500 (EST) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 D01181E091 for ; Thu, 23 Nov 2023 12:36:36 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3A26F3858C2F for ; Thu, 23 Nov 2023 17:36:36 +0000 (GMT) Received: from mail.thepuzzlemaker.info (mail.thepuzzlemaker.info [158.69.213.140]) by sourceware.org (Postfix) with ESMTPS id C79B43858D35 for ; Thu, 23 Nov 2023 17:36:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C79B43858D35 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=thepuzzlemaker.info Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=thepuzzlemaker.info ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C79B43858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.213.140 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700760986; cv=none; b=EJ+LHVm/D8QNsLn8zXsH2f/QN2RlPgyTFGzHjySiChGESEz4KbAqUMKtwbVHzlbEior9JNdaABag8V9dhJVZBqugznFVCUS5GrrcSJuoX2IOa7wnnE74xU+0XJXATcLBmUEoUDlqz4r3OU+Mxg2iPWM7tXdpGuExx3dph9I8oKk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700760986; c=relaxed/simple; bh=gAKcYMmqJWJj+wXDNtrJKjdV9v1b8nedXE3yH18yLRk=; h=DKIM-Signature:From:To:MIME-Version:Date:Subject:Message-ID; b=kHLOixNxkTAtptn2n6qenII60qLp5+j7GQ4wz9LiMwT8N3mBAjdY26ufnP/3jlho2UrWbwgaYPsgd4yKHcA/kQ6EJAzDtEpf8XeimovcUYfo39JMSRxdxE+/GSfHeddxhM+zaVWQM0BVYCfF9aIQDw5/Svxi+jFqAs/jMEQ0/CU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPA id 371A6E0E14 for ; Thu, 23 Nov 2023 11:36:24 -0600 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thepuzzlemaker.info; s=default; t=1700760984; h=from:subject:date:message-id:to:mime-version:content-type: content-transfer-encoding; bh=Al2Dk59egJCMM5hwAdhYFsr3C/8VMBQas2wJbhao1nU=; b=B/aKlFsihyGGhqdbkUWRxrN/x/K0yWfKz1JpXEJVMQoRSnKd9krrw8FbMMnu/XdUzqFfGV 9acwDslUQ8bZE4Ax2266ROAEp8NbYNi1Y/13pxHoHrjDL/Y0pA8M6xbsPrC6UdOtRhpIQ8 JxsR4j6CU1yIwakyPNEqOJP+yrWs6GjyMTbzJB+i4HEgTRbidbKqPZ/HPG8NfIRNVgOvU6 7io0tN+lJP0elBINnv0+ShWykYhQiuS4hiUlKqHCfR/h2uGn4QwwpLj6omeMqMtk86qXlC nIf5i519Wni1e7/hOqriwhCCphmxPNvkhO2TgewtRaOorJ0gFqXvUOk7X5Rxow== From: "The Puzzlemaker" To: gdb-patches@sourceware.org User-Agent: SOGoMail 5.9.0 MIME-Version: 1.0 Date: Thu, 23 Nov 2023 11:36:23 -0600 Subject: [FIXED] [PATCH 1/1] =?utf-8?q?rust-parse=3A?= Infer some integer constants as u64 Message-ID: <47-655f8d80-3-52811600@102229502> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: None X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_INFOUSMEBIZ, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, 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: 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 This is a bit hacky, I admit. This commit causes integers in the range `2^63-1 <=3D x <=3D 2^64 - 1` to be inferred as `u64` instead of as `i1= 28`. This helps solve an issue where these integers would not be able to be used as addresses, helpful when e.g. debugging higher-half kernels. --- gdb/rust-parse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c index 4b3348d8ca6..a807884bd20 100644 --- a/gdb/rust-parse.c +++ b/gdb/rust-parse.c @@ -1033,9 +1033,13 @@ rust=5Fparser::lex=5Fnumber () if (implicit=5Fi32) { static gdb=5Fmpz sixty=5Fthree=5Fbit =3D gdb=5Fmpz::pow (2, 63); + static gdb=5Fmpz sixty=5Ffour=5Fbit =3D gdb=5Fmpz::pow (2, 64); static gdb=5Fmpz thirty=5Fone=5Fbit =3D gdb=5Fmpz::pow (2, 31); - - if (current=5Fint=5Fval.val >=3D sixty=5Fthree=5Fbit) + static gdb=5Fmpz thirty=5Ftwo=5Fbit =3D gdb=5Fmpz::pow (2, 32); + =20 + if (current=5Fint=5Fval.val < sixty=5Ffour=5Fbit && current=5Fint=5F= val.val >=3D thirty=5Ftwo=5Fbit) + type =3D get=5Ftype ("u64"); + else if (current=5Fint=5Fval.val >=3D sixty=5Fthree=5Fbit) type =3D get=5Ftype ("i128"); else if (current=5Fint=5Fval.val >=3D thirty=5Fone=5Fbit) type =3D get=5Ftype ("i64"); --=20 2.43.0 Sorry about the last email, my email client was not set up right for pl= aintext. See #31082, https://sourceware.org/bugzilla/show=5Fbug.cgi?id=3D31082 Let me know if there's anything I missed here. Thanks, James aka ThePuzzlemaker