From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13280 invoked by alias); 2 Sep 2013 18:24:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 13263 invoked by uid 89); 2 Sep 2013 18:24:09 -0000 Received: from qmta15.emeryville.ca.mail.comcast.net (HELO qmta15.emeryville.ca.mail.comcast.net) (76.96.27.228) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 02 Sep 2013 18:24:09 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,RDNS_NONE,SPF_PASS autolearn=no version=3.3.2 X-HELO: qmta15.emeryville.ca.mail.comcast.net Received: from omta16.emeryville.ca.mail.comcast.net ([76.96.30.72]) by qmta15.emeryville.ca.mail.comcast.net with comcast id LJ041m0041ZMdJ4AFJQ6y9; Mon, 02 Sep 2013 18:24:06 +0000 Received: from up.mrs.kithrup.com ([24.4.193.8]) by omta16.emeryville.ca.mail.comcast.net with comcast id LJQ61m00e0BKwT48cJQ6zZ; Mon, 02 Sep 2013 18:24:07 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: Re: [RFC] Changes to the wide-int classes From: Mike Stump In-Reply-To: <87ob8bbpkl.fsf@talisman.default> Date: Mon, 02 Sep 2013 18:24:00 -0000 Cc: "gcc-patches\@gcc.gnu.org Patches" , rguenther@suse.de, Kenneth Zadeck Content-Transfer-Encoding: quoted-printable Message-Id: References: <87wqn0bb5q.fsf@talisman.default> <5223F9D7.1030307@naturalbridge.com> <873699CE-3E8F-4285-8C6C-6B488B92982F@comcast.net> <87ob8bbpkl.fsf@talisman.default> To: Richard Sandiford X-IsSubscribed: yes X-SW-Source: 2013-09/txt/msg00084.txt.bz2 On Sep 2, 2013, at 1:22 AM, Richard Sandiford = wrote: > What I'm saying is that the assert stops plain: >=20 > max_wide_int x =3D wide_int_var; Sorry for being slow. I see the point, indeed, from the preexisting code, = we did: fixed_wide_int (const wide_int_ro w) : wide_int_ro (w) { /* We only allow the same size in, as otherwise=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20 we would not know how to extend it. */ gcc_assert (precision =3D=3D bitsize); } to disallow it dynamically. Doing this, or pushing it further into the typ= e system so that it is caught a compile time, is fine. I also like the passing of sign: max_wide_int x =3D max_wide_int::from (wide_int_var, SIGNED); max_wide_int x =3D max_wide_int::from (wide_int_var, UNSIGNED); like this. In the previous code we did: static inline fixed_wide_int from_wide_int (const wide_int& w) { if (w.neg_p (SIGNED)) return w.sforce_to_size (bitsize); return w.zforce_to_size (bitsize); } which is, as you point out, dangerous.