Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1104348pxb; Sat, 17 Apr 2021 06:48:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5VS/UCvTYTYcc4y5BXtjoxOzbVeAbPaCdP54FN3L4bkObFHVcwU49blUuk6vjMPlHVOLC X-Received: by 2002:a17:906:8407:: with SMTP id n7mr12786910ejx.264.1618667285380; Sat, 17 Apr 2021 06:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618667285; cv=none; d=google.com; s=arc-20160816; b=ub7t01p7GtBzXdmPfHqyayaztPm+BbyMUyHqlU4zpoBD19iWw1io+Q98JWxicvGeH5 HitSbmWVISIvZlVh5476sVq+ACbRGALLsIV7I/YbDjQewlvE4sCnJn3LB3t/I7EZHJTj jpm5j9w28ub5R7yS6F/ctajTpTZiLhyPZxF1i/EG9dZumIQOLgs4rFpGskPNCPko4OSu ijBD0BGAsra5oMcYaE7V/F0TIyNlN62CXN8nOG6LlYAD4an+l5zpKxeiwGYRr+dd9YAh RVeCg/NaDlnBIUxqLAedzgNw1vE9cGdFatxTMr5e/4t+uF/XjCJYVg1QB2oSukFWkSc9 tYxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=qRoKpP7/j20B3SyiB1dVfbG1FrOj0S3iYddlV27/wXM=; b=qBH3i+MVNtdWL90XwmFYsHV7kWMA2Grlk37XtewUiDVqmGzNVsiQqBY3vmAg9sAQXc TkcNi/Vo/+Vj+MYjxNZxjEZ/EA8eU+p3bZ1c4QOQxdn0HwFKohAp2S4l+zOnhxQEhWPV 9Jxc+T1ADgo6aBWtmJ4t+Sq7MntMuvm7tKEK76zLBXyZKAL+K8QrOWvhg1lfw2t8BWPH s8TbLKrtcbA68ARGedaMUPoihbS3a4OGFsp5xGc7su+MCM75F+nSNCOs6CpKidX8f21r fbqxQjO1+SX4PoUtXU5l/qSqcYXV5xT4rOyGe5eWH10CRsQbSKa1omU+kfFa4qOMbUWT qQOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kq12si3781566ejb.695.2021.04.17.06.47.30; Sat, 17 Apr 2021 06:48:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236405AbhDQNqs convert rfc822-to-8bit (ORCPT + 99 others); Sat, 17 Apr 2021 09:46:48 -0400 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:31731 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236377AbhDQNqr (ORCPT ); Sat, 17 Apr 2021 09:46:47 -0400 Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-111-IAuWgVVUPrqCWucM5QzTnw-1; Sat, 17 Apr 2021 14:46:17 +0100 X-MC-Unique: IAuWgVVUPrqCWucM5QzTnw-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 17 Apr 2021 14:46:17 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.015; Sat, 17 Apr 2021 14:46:17 +0100 From: David Laight To: 'Peter Zijlstra' , Matthew Wilcox CC: Miguel Ojeda , Willy Tarreau , Wedson Almeida Filho , Miguel Ojeda , Linus Torvalds , Greg Kroah-Hartman , "rust-for-linux@vger.kernel.org" , Linux Kbuild mailing list , Linux Doc Mailing List , linux-kernel Subject: RE: [PATCH 00/13] [RFC] Rust support Thread-Topic: [PATCH 00/13] [RFC] Rust support Thread-Index: AQHXM3s7R6TAvlURwUWbKsHSAM883qq4tusA Date: Sat, 17 Apr 2021 13:46:17 +0000 Message-ID: <302c00b5de4d4320b8770aae7d84e175@AcuMS.aculab.com> References: <20210414184604.23473-1-ojeda@kernel.org> <20210416161444.GA10484@1wt.eu> <20210416180829.GO2531743@casper.infradead.org> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Zijlstra > Sent: 17 April 2021 12:17 ... > > (i'd argue this is C being broken; promoting only as far as int, when > > assigning to an unsigned long is Bad, but until/unless either GCC fixes > > that or the language committee realises that being stuck in the 1970s > > is Bad, people are going to keep making this kind of mistake) > > Well, I think the rules actually make sense, at the point in the syntax > tree where + happens, we have 'unsigned char' and 'int', so at that > point we promote to 'int'. Subsequently 'int' gets shifted and bad > things happen. The 1970s were fine. K&R C was sign preserving - so 'unsigned char' promoted to 'unsigned int'. The ANSI C committee broke things by changing it to value preserving with the strong preference for signed types. Even with ANSI C the type of ((unsigned char)x + 1) can be unsigned! All it needs as an architecture where sizeof (int) == 1. (sizeof (char) has to be 1 - even though that isn't directly explicit.) Of course, having 32-bit 'char' and 'int' does give problems with the value for EOF. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)