From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailrelay.tugraz.at (mailrelay.tugraz.at [129.27.2.202]) by sourceware.org (Postfix) with ESMTPS id B08F33858D37 for ; Mon, 18 Mar 2024 11:56:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B08F33858D37 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=tugraz.at Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tugraz.at ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B08F33858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=129.27.2.202 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710763018; cv=none; b=jLWW/aLIwxUQX0pTp2od9xb/OabDKPCXWQ0OlGe1BTfNbS/UjYrNHurSGMbnHtf7xxA4xteHntyInyfaeBgpddEk0sjdRFNnjnucMAP9CCljqCmVhWf9MzIoaRW8+4uLZPvqwYOJIDODW1b6/uW6J0pRMC038/5aQgYeWv5kA+8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710763018; c=relaxed/simple; bh=5rLhiuFwOAKh4FJEghfRGCJ3J0pPG7l+2zzufJFfw+E=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=jwD64Xqmln30s96ZbR0vjA4VueAr1mFVR2y7yww/hTZ/NKPEh0jzEaOwKjAPLDNWqSONsqJKDfaESMxLDJEOH2dCRU8fHzkPaf3MKZCUe+biS0dVdxxCoAkSc5ZpImVPNM4ZQPIrVdCE+sHROfTHhAHdncv+1JKlH67OfhrWloI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from fbmtpc21.tugraz.at (fbmtpc21.tugraz.at [129.27.144.40]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4Tytch4Mwmz3xBf; Mon, 18 Mar 2024 12:56:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1710763012; bh=+ZBhCvI1spBoSHXm7fPMYZQtXk+GBN3O34hTPFIuqms=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=YAGMUXzvGExWXBiPUk1+fcMZiuK2USBw9XBsyJgaIwzKnyeRSA6cw4GMDvM339P6J 4bx1t7PPZewB3JWyoh0W7tOhfZALLXDQn+2lM8ZQA4k4MSUwV7UbMEcpcj9BGDcfn6 l65EqnVRh91tBBpY8ppDl7xR7C6gAd9pblekFG0o= Message-ID: Subject: Re: aliasing From: Martin Uecker To: Richard Biener Cc: gcc@gcc.gnu.org Date: Mon, 18 Mar 2024 12:56:52 +0100 In-Reply-To: <80d108c853404b7f1e48bf001db37d94e6651f42.camel@tugraz.at> References: <80d108c853404b7f1e48bf001db37d94e6651f42.camel@tugraz.at> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 MIME-Version: 1.0 X-TUG-Backscatter-control: G/VXY7/6zeyuAY/PU2/0qw X-Spam-Scanner: SpamAssassin 3.003001 X-Spam-Score-relay: -1.9 X-Scanned-By: MIMEDefang 2.74 on 129.27.10.117 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,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: Am Montag, dem 18.03.2024 um 11:55 +0100 schrieb Martin Uecker: > Am Montag, dem 18.03.2024 um 09:26 +0100 schrieb Richard Biener: > > On Mon, Mar 18, 2024 at 8:03=E2=80=AFAM Martin Uecker wrote: > >=20 >=20 > >=20 > > Let me give you an complication example made valid in C++: > >=20 > > struct B { float x; float y; }; > > struct X { int n; char buf[8]; } x, y; > >=20 > > void foo(struct B *b) > > { > > memcpy (x.buf, b, sizeof (struct B)); // in C++: new (x.buf) B (*b); >=20 > Let's make it an explicit store for the moment > (should not make a difference though): >=20 > *(struct B*)x.buf =3D *b; >=20 > > y =3D x; // (*) > > } > >=20 > > What's the effective type of 'x' in the 'y =3D x' copy?=C2=A0 >=20 > Good point. The existing wording would take the declared > type of x as the effective type, but this may not be > what you are interested in. Let's assume that x has no declared > type but that it had effective type struct X before the > store to x.buf (because of an even earlier store to=C2=A0 > x with type struct X). >=20 > There is a general question how stores to subobjects > affect effective types and I do not think this is clear > even before this proposed change. Actually, I think this is not allowed because: "An object shall have its stored value accessed only by an lvalue expression that has one of the following types: =E2=80=94 a type compatible with the effective type of the object, ... =E2=80=94 an aggregate or union type that includes one of the aforementioned types among its members (including, recursively, a member of a subaggregate or contained union), or =E2=80=94 a character type." ... and we would need to move "a character type" above in the list to make it defined. Martin