From owner-sc22wg14+sc22wg14-domo2=www.open-std.org@open-std.org  Thu Mar 20 14:21:01 2025
Return-Path: <owner-sc22wg14+sc22wg14-domo2=www.open-std.org@open-std.org>
X-Original-To: sc22wg14-domo2
Delivered-To: sc22wg14-domo2@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id 7CD96356895; Thu, 20 Mar 2025 14:21:01 +0100 (CET)
Delivered-To: sc22wg14@open-std.org
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124])
	by www.open-std.org (Postfix) with ESMTP id 07E04356682
	for <sc22wg14@open-std.org>; Thu, 20 Mar 2025 14:21:00 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
	s=mimecast20190719; t=1742476859;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=vzBi3teBVa4bt9+hVezmYmmZneKxr/17PDbjn5UM9GQ=;
	b=BwZplmqgMMd/g95065iXiSPQUsVMLKmpY+WirgE8G4eFjqzki60/r3EZHTMwUoYJGXtJkQ
	ZZv2k97DdN3RpuAIyYH/vupb5a6X6MaN8SAYfUw19HORl40/ylfk1A4bizdBrGO4dFuy/6
	RoXN0JndyUX3x0TqHN5poN/sv87QyOo=
Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com
 [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS
 (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id
 us-mta-410-5GfL7BikNM6PFcOK0Opicw-1; Thu, 20 Mar 2025 09:20:58 -0400
X-MC-Unique: 5GfL7BikNM6PFcOK0Opicw-1
X-Mimecast-MFC-AGG-ID: 5GfL7BikNM6PFcOK0Opicw_1742476857
Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-43d08915f61so4953095e9.2
        for <sc22wg14@open-std.org>; Thu, 20 Mar 2025 06:20:57 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1742476857; x=1743081657;
        h=mime-version:references:message-id:in-reply-to:subject:cc:to:from
         :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
        bh=FsE5Csa5EMU360E4ONBege1iAHBB2SPQMPdKbylSmCM=;
        b=GmLLTIMqEBPeAOnAJE9u2Sk3l4auBlcomZZHVMw0hZuOjwQ6ivZIOIoDVxEsXvw217
         1Eho3Gzmf8QHZj/nfIZrvROQj2WvfSf1bF1SDYa06t7XMSOdnfaZ4w7L9bd6DBd4q5tx
         ysDaTVt/5I/8vn8wFiUqQT3CeCwEaBLEQCrYmYvTWlTYICkWTmZwowFbHW9GG1Gms59c
         54lUH/vB3fU2RFljIqOp8urdPzinknX4CJAw7Tt/NPcGyRXjqjnsQtFCMK7a6VvSYvWL
         b8tgYg1Rh5pran7hDkXMJ9XMrpi4Rxycp3ePSXnnoxD0i4Bs5Vez8pBmfTxXlvXYwPKM
         Ikew==
X-Forwarded-Encrypted: i=1; AJvYcCWfRREXGkL4FkKPBtDkkgTIJcwc6H9UOoVMaWHfGgtfKEZ5p2J5rA5PX+1xk0Ni2Floqe8DCe6KiA==@open-std.org
X-Gm-Message-State: AOJu0YxmaLRolBTTp9I78UDpmmoUbs338HRF45MCUr4wKlcMcpSUpkQp
	2xI270B1DQfNNPyxFQ3lGj+lntho28skH9r4UxsDPVKeLTLInX+o/w/I7mCcM/nsFt0OXZGiJmy
	eM7bdnhAVmsQ+8gfjhdlyRtPaNs4uS6LFI5xbGmOT07ZaguprVLo8
X-Gm-Gg: ASbGncvwkwukY6KwPpMWaeShPPVuHwKVSa72XqEIFsx5AqOSaGoOjauFYxylM9RnSAB
	aLiIigpKiR6G2jlW80M4H2wBwKPiRyViLzPR5Ez+0lldDMnY5h203a19yr0n50JPl8bSpRm7mv+
	nXKrR0wIHorUyJP/ZOuoSbrFEmt2W5u+JARzCjLmsXpgsa6/d5q67r7yH3nEsmOkF0lHV6wPZu9
	jtyB9kvCpE2G79Bb2F2p5giGYQtX7ffW2UEuC+SKXrISsNJn9FpWN4RoUrk6mJhdDZU15n0ylOd
	qfwHWcsHQairtfI1jsA52FyCGjbvbdSJU0AnSPJusZW2bDA=
X-Received: by 2002:a05:600c:1c03:b0:43c:fc04:6d48 with SMTP id 5b1f17b1804b1-43d4942412fmr28430035e9.0.1742476856806;
        Thu, 20 Mar 2025 06:20:56 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IFqlDpzbDncrwrYfdwKNubGh2QqnApnG2IzQF6CGs/nF2nL/eZVONpjT2wPD8AOe5HN5aLzRw==
X-Received: by 2002:a05:600c:1c03:b0:43c:fc04:6d48 with SMTP id 5b1f17b1804b1-43d4942412fmr28429695e9.0.1742476856341;
        Thu, 20 Mar 2025 06:20:56 -0700 (PDT)
Received: from digraph.polyomino.org.uk (digraph.polyomino.org.uk. [2001:8b0:bf73:93f7::51bb:e332])
        by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43d43f33237sm48640885e9.4.2025.03.20.06.20.55
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 20 Mar 2025 06:20:55 -0700 (PDT)
Received: from jsm28 (helo=localhost)
	by digraph.polyomino.org.uk with local-esmtp (Exim 4.97)
	(envelope-from <josmyers@redhat.com>)
	id 1tvFpO-0000000C2Al-0wnH;
	Thu, 20 Mar 2025 13:20:54 +0000
Date: Thu, 20 Mar 2025 13:20:54 +0000 (UTC)
From: Joseph Myers <josmyers@redhat.com>
To: =?UTF-8?Q?J=E2=82=91=E2=82=99=E2=82=9B_Gustedt?= <jens.gustedt@inria.fr>
cc: Robert Seacord <rcseacord@gmail.com>, 
    "sc22wg14@open-std. org" <sc22wg14@open-std.org>
Subject: Re: [SC22WG14.29934] 30 DAY REVIEW N3517 Gustedt, Array subscripting
 without decay v7
In-Reply-To: <20250320103716.923FA3568E3@www.open-std.org>
Message-ID: <cce180d3-799c-52c8-6979-2573c08715c9@redhat.com>
References: <20250319173407.EDB283568EB@www.open-std.org> <20250319175258.58C4A3568EB@www.open-std.org> <20250320103716.923FA3568E3@www.open-std.org>
MIME-Version: 1.0
X-Mimecast-Spam-Score: 0
X-Mimecast-MFC-PROC-ID: hmZA6ObznkV0KbWLTkGmL0c3uk8DJumFAxvP2nAZ9T4_1742476857
X-Mimecast-Originator: redhat.com
Content-Type: multipart/mixed; boundary="-1152306461-1008947481-1742476854=:2858159"
Sender: owner-sc22wg14@open-std.org
Precedence: bulk

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.
---1152306461-1008947481-1742476854=:2858159
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8BIT

On Thu, 20 Mar 2025, Jₑₙₛ Gustedt wrote:

> (1) unqualified, which for the standard covers only `const`,
> `volatile` and `restrict`
> 
> (2) non-atomic, which is a can of worms
> 
> For (1) I think that our paper is correct, because anyhow such an
> "rvalue object" is a copy of some sort, and this is what we have done
> for now, anyhow.

The question with arrays, outside of typeof, is for example whether

struct s { const int a[2][2]; } x;
void f1() { if (0) *((0, x).a[1] + 1) = 1; }
void f2() { if (0) *(*((0, x).a + 1) + 1) = 1; }

should involve constraint violations (assignment to const int) versus 
runtime UB (which doesn't actually occur because it's inside if (0)).

With the wording I proposed in issue 1001, the array and its members keep 
the qualified type even as part of the rvalue structure (0, x), and the 
type only becomes unqualified when producing a non-array rvalue.  So both 
f1 and f2 involve constraint violations; the arrays decay to pointers to 
const.

I think this proposal would remove the constraint for f1 only, by giving 
(0, x).a[1] the type int[2] rather than const int[2].

-- 
Joseph S. Myers
josmyers@redhat.com
---1152306461-1008947481-1742476854=:2858159--

