From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FC033FE4A for ; Wed, 5 Jun 2024 18:25:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717611920; cv=none; b=EDdpBfTbWxk0NGX3NxzxG8EOvvOrmJRJzFP+01XVyQpWMMwO7SqHEYRMtMuWXlOfKdMapz09DTpWrNyIcGSFV5Cjt3NMLByo9jPR4GoVgIdUXoNUD7lwe39gN0om0Mk6mvvEgYzQddGzi0D6JASGhrAEG2nUttsqieRn1TRAbtU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717611920; c=relaxed/simple; bh=ctiqdvT5xlUoFTQLDzo15qu5MLnfQNjfzhWz8rf2jOk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=jQw6AC1QCtR7m/VaeTwlL2V3AnmLW5UM6xOsmVCawXRaiqrAVyDywui/CmPHnVGVLkW/6gLeogYlEEWpe7x3neD5QJ5cnycn4GK70w+HOE0BdUghbdI+pPQuX/6hTh/5ls6zxVHvuvGARHHFIIBmaCASV1DvfKgdclx6HnvJxtI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linuxfoundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=JDPce0Be; arc=none smtp.client-ip=209.85.218.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linuxfoundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="JDPce0Be" Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a68c8b90c85so16714166b.2 for ; Wed, 05 Jun 2024 11:25:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1717611916; x=1718216716; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=6/xT8sJY/vun3yP1sOXfrmnihkrGFdMvIOAXA7zHRa0=; b=JDPce0BeA9hGonA+hc9Kl7VcxMc8oDuPfG2EeeDWV3eqTQsTG1twmYcdKxXIlz+5Uj pqU6nXEnOptD5O7UGqpzFFVM4OuegKs9pwBrwY4hSRlhvOjhTIrRS6wr33qeY9hIfGwU xko3WAMc0mlj1wOzS8pZ4c11rIkYu64dc1CQc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717611916; x=1718216716; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6/xT8sJY/vun3yP1sOXfrmnihkrGFdMvIOAXA7zHRa0=; b=K5d1JBGXvdZCIyJSDHwxa8B7ybYPsvFYYN3M2bZXFLPT9NG2sdO5PaXeOc60+9dBDM dPftzpMRya4WC5r1Nxpx5Zhd5sdxpGpRYAfjDVqUYitrbwjpzHZ06z5FKAM4cd4hG2JY fI8nZ2/e/UCS8U17CRO/bcWINb7a0X+eU9xBc+X34bofgxl12cbHmru7oggFt0ZHs9cy 4gJjvI6eEsGmvBG2JMxEwgMEoMj/qyJeOAkfsx1lhyABMZv+MXoLKKeLIsjt66L6LO70 D84iPK7cTZZv8bQktHM2OEZrcsDsKPAQnQDEXmChJXmn/e8XIIYOFvPdGb3f8MfJy803 wd6A== X-Gm-Message-State: AOJu0YwgIqOg2KJdYZHNa7k8W6mF+gm55sZShs3QEET9mQLWueomoUjO E22M7HZOyDJckf84CSlFE1KNCvt07iej4nZ68zcBePsu/DtQ1yXCWFt7Zj0DmQ/YOWhYT99T1hX cwLQf3Hy0 X-Google-Smtp-Source: AGHT+IFw8L0OqJeijl/OEl/PvhNIAeyGbY6GTM0ZofgE9Q7Qwdp0Ypbk79yV+3mcyW70vX7P2Q6ygQ== X-Received: by 2002:a17:907:784f:b0:a6a:ab5:6f2a with SMTP id a640c23a62f3a-a6a0ab57a06mr228650466b.11.1717611916543; Wed, 05 Jun 2024 11:25:16 -0700 (PDT) Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com. [209.85.218.48]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a68fec60bcdsm523718966b.122.2024.06.05.11.25.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Jun 2024 11:25:15 -0700 (PDT) Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-a68a9a4e9a6so15451666b.3 for ; Wed, 05 Jun 2024 11:25:15 -0700 (PDT) X-Received: by 2002:a17:906:b51:b0:a68:7a25:1963 with SMTP id a640c23a62f3a-a699f671d30mr275820166b.32.1717611914901; Wed, 05 Jun 2024 11:25:14 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-toolchains@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <83f5e119-6e32-415a-a1c8-8e6b0bd11a75@paulmck-laptop> In-Reply-To: From: Linus Torvalds Date: Wed, 5 Jun 2024 11:24:58 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: A few proposals, this time from the C++ standards committee To: paulmck@kernel.org Cc: linux-toolchains@vger.kernel.org, peterz@infradead.org, hpa@zytor.com, rostedt@goodmis.org, gregkh@linuxfoundation.org, keescook@chromium.org Content-Type: text/plain; charset="UTF-8" On Wed, 5 Jun 2024 at 11:08, Linus Torvalds wrote: > > I would suggest that people look at improving 'restrict' and making it > more useful, and just admit that the type-based thing was a mistake. Note that I did see the other proposal on 'restrict', but I think that one was a pretty small improvement. I think people should work on making it work better in general. Real compilers already effectively do that thin in much more interesting ways, as part of finding the origin of a pointer. For example, both clang and gcc have a notion of "alloc-like" functions: __attribute__((__malloc__)) which is a function attribute that basically says "the returned pointer is a 'restricted' pointer". Except it is much better than the 'restrict' keyword, in that it actually works on real loads. So I think the real answer to type-based aliasing is to throw the garbage out, and instead help extend on existing notions of "provenance of where the pointer came from". Because compilers already do a *lot* of that kind of alias analysis, and I think the proper approach is to strive to help compilers do better on something reliable, instead of working around the fact that some rodent-like creature got dropped on its head a few too many times, and came up with the notion of type-based aliasing. Linus