From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id EE93C3858D37 for ; Mon, 18 Mar 2024 16:46:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE93C3858D37 Authentication-Results: sourceware.org; dmarc=fail (p=quarantine dis=none) header.from=westcontrol.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=m.gmane-mx.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EE93C3858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=116.202.254.214 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710780398; cv=none; b=fudzQ7XU+upro5MKOmBUERiiwVOLYDZ08X/BMQti6juKEeymmsNzj1eSFNmcgASvTqCvcWQ5p/TbtmrtIJOiHAmrc2eMBOTyFVaDmWslBTOpqsQHCBJAL/soCabQ34nmzScXliBTNFuqkDSKCtjzLfdDWXBqGZi0iWwwQGTv5hg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710780398; c=relaxed/simple; bh=vHet8h9FaB8qn9EhMlfl3xOeT6LpinrfgVv8tq+DsM4=; h=To:From:Subject:Date:Message-ID:Mime-Version; b=dncBSjkUSNRnfFtQTCz7icqnIAXeIB2Zv6JYYjwEi+8Zf5dpVizOWfIIMu0oh/nMRVZTLswQukAd/IQR5qgfOJwU9W0eErye6HhpJrjxAYR6iP7747uA8kMvYtquEpvdbGsyPiOUK4SarLcQtgXXDHInW18Ieher8wAHKIrE+SM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1rmG8B-0004TM-N5 for gcc@gcc.gnu.org; Mon, 18 Mar 2024 17:46:35 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: gcc@gcc.gnu.org From: David Brown Subject: Re: aliasing Date: Mon, 18 Mar 2024 17:46:30 +0100 Message-ID: References: <089a1300d266a3921feab4efb911987ca465e5c9.camel@tugraz.at> <6bff9afd-3e84-4260-9d05-8faec5f3ebe2@hesbynett.no> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Content-Language: en-GB In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 18/03/2024 14:54, Andreas Schwab via Gcc wrote: > On Mär 18 2024, David Brown wrote: > >> I think it would be possible to have an implementation where "signed >> char" was 8-bit two's complement except that 0x80 would be a trap >> representation rather than -128. > > signed char cannot have padding bits, thus it cannot have a trap > representation. > The premise is correct (no padding bits are allowed in signed char), but does it follow that it cannot have a trap representation? I don't think the standards are clear either way here - I think the committee missed a chance to tidy up the description a bit more when C23 removed formats other than two's complement for signed integer types. I also feel slightly uneasy using signed char for accessing object representations since the object representation is defined in terms of an unsigned char array, and conversion from unsigned char to signed char is implementation-defined. (This too could have been tightened in C23, as there is unlikely to be any implementation that does not do the conversion in the obvious manner.) But I am perhaps worrying too much here.