From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-40140.protonmail.ch (mail-40140.protonmail.ch [185.70.40.140]) by sourceware.org (Postfix) with ESMTPS id 06CBB3858D1E for ; Wed, 28 Jun 2023 07:34:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 06CBB3858D1E Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=protonmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=protonmail.com Date: Wed, 28 Jun 2023 07:34:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1687937667; x=1688196867; bh=5QVaB9NgIRps2JoEL/zMCJymkztqlXMmgmXlyRFTZd0=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=JlXA69Ze1MLxfcQ/9p5kNfvLR9Hv6aBPVR8jbUqCX5mWKAPfWAXcXdCW1m/65mA/Q Ycp5vlumqMLnb+9rVBUu3aWsfEvBwPYNdJWzQxjoEr+HdtXr49gljtP4UvDAfXKZhA 7TTEJyqi9ccJ2fdJSBDB2tpu9xpa85hXX+9KU/SB6awFtpD3B7M1MRkZ3bv1c3BFSS MqC+arsaagpSWTmd9QeSNyztjaNc6K5WKeAJbHNgO4mLyQ5DcqEbQsbbgeh52rnEC3 8vDgUBiN70rXHu8d+s9XGxRg6MKrGmeN67IaTxv05f+yzv3UGSQD5i9iReV5eSUnAy QVvX1aRJO35kA== To: =?utf-8?Q?Rafa=C5=82_Pietrak?= From: waffl3x Cc: "gcc@gcc.gnu.org" Subject: Re: wishlist: support for shorter pointers Message-ID: <-AB6SYCrclnTmCplUifwnztcXATzTfsIcSdqPiIDWWf62GXrgL4AVMQE5Gq-7E5XcE2PcoOtDpBiZdV2K0l_LTZlb_WJnOyc3JHrqc7GeMs=@protonmail.com> In-Reply-To: References: <439affd4-11fe-de80-94c8-6fc64cbf76ec@ztk-rp.eu> Feedback-ID: 14591686:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 List-Id: >This is from just one source file, which otherwise is "plain C". If I >was to put it into a library that use "asm tweaked fancy pointers", a >portable fragment of code becomes "target dedicated" - this is undesired. I sympathize with your desire to not lock your codebase to a particular target, I agree, it's important to keep it generic. I would definitely desi= gn the library to allow customization of the utilities for a given target. I imagi= ne this gets a little difficult if you're setting up registers a certain way, but w= rapping some ASM in a function object, and then forcing the call to that object to = inline should do the trick there. From there, any code that you want to remain por= table would have to take the pointer type by template parameter. Unfortunately, I= can imagine the secondary part of this creating problems in an embedded project= if you had to instantiate too many different functions from the templates. >------------------- >=09=09=09=09y->next =3D NULL; >=09=09if (our) { out->next =3D a; >=09=09for (y =3D t->HD; y && y->next; y =3D y->next) >=09=09if (y)=09y->next =3D a; >=09=09=09fit->HD =3D a->next; >=09=09fit->win =3D a->next; >=09=09=09b =3D a->next; >-------------------- I suspect that this snippet that you shared might not be quite as portable as you think. It looks to me like it relies on type punning. Type punning c= an indeed be implemented in a well defined manner, in my experience though it = rarely is. With that said, strict aliasing is very difficult to understand so I would = not be surprised if I was mistaken here, especially since there's not enough code = in the snippet to be certain. -Alex