From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KG5zCm5yvF9LWwAAWB0awg (envelope-from ) for ; Mon, 23 Nov 2020 21:39:42 -0500 Received: by simark.ca (Postfix, from userid 112) id 250171F0AB; Mon, 23 Nov 2020 21:39:42 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.2 Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id CF7251E58E for ; Mon, 23 Nov 2020 21:39:41 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2FB9A3892002; Tue, 24 Nov 2020 02:39:41 +0000 (GMT) Received: from rock.gnat.com (rock.gnat.com [205.232.38.15]) by sourceware.org (Postfix) with ESMTP id A8BA5386F452 for ; Tue, 24 Nov 2020 02:39:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A8BA5386F452 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=brobecker@adacore.com Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4EA44116470; Mon, 23 Nov 2020 21:39:38 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at gnat.com Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ehMWF8vaAvOz; Mon, 23 Nov 2020 21:39:38 -0500 (EST) Received: from float.home (localhost.localdomain [127.0.0.1]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPS id EE19A116406; Mon, 23 Nov 2020 21:39:37 -0500 (EST) Received: by float.home (Postfix, from userid 1000) id 5828CA6B96; Tue, 24 Nov 2020 06:39:32 +0400 (+04) Date: Tue, 24 Nov 2020 06:39:32 +0400 From: Joel Brobecker To: Simon Marchi Subject: Re: pushed: Add support for DWARF-based fixed point types Message-ID: <20201124023932.GA1111357@adacore.com> References: <1604817017-25807-1-git-send-email-brobecker@adacore.com> <1605429345-78384-1-git-send-email-brobecker@adacore.com> <20201118034727.GF617116@adacore.com> <20201122140036.GA604842@adacore.com> <5e62ef60-93d7-ad52-4f9d-b23266ae4fc8@simark.ca> <20201123042711.GA967337@adacore.com> <356a7864-d6aa-70ed-0444-7e19a4d5c2c9@simark.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <356a7864-d6aa-70ed-0444-7e19a4d5c2c9@simark.ca> X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" > > I found the source of the problem, which was in a way subtle-enough > > that you really have to pay attention to these details (which, > > luckily, are handled automatically thanks to our minor C++-ification > > of GMP in gmp-utils), and yet so obvious once you find it. > > Attached is the patch that I will push later today (need to run RSN, > > and don't want to make a mistake because I'm rushing). > > > > I think this error might be highlighting a weakness, though. I need > > to investigate more, but I'm thinking it might be wise to add some > > checks during export that the buffer size is large enough to fit > > the value. In other words, I'm thinking of having our own > > safe_mpz_export which double-checks the size of the buffer according > > to the formula given by the documentation, and raises an error if > > too small. > > > > The fact that GMP happily goes beyond the end of the buffer is > > a bit unexpected, still. Maybe something to report to the GMP team. > > Ah, nice! The explanation in the commit message makes sense, thanks. My pleasure. I was relieved to find that the main issue was in the unittest itself! There's still the question of protecting ourselves from this kind of issue, just in case, but at least there we know what to be careful of. I just pushed the patch to master, and will work on catching those issues over the weekend. gdb/ChangeLog: * unittests/gmp-utils-selftests.c (write_fp_test): Use mpq_set_si instead of mpq_set_ui to initialize our GMP rational. -- Joel