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 A3E383858D37 for ; Mon, 18 Mar 2024 07:03:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A3E383858D37 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 A3E383858D37 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=1710745433; cv=none; b=D4Jylon4VPut1gn4J5b7tNizg+4xW2jhrOSOpsQewGbsrBPWTj9WxlPgC2Yn53wQeblzHmyCK8NbnC8SPsXlbR37hh506Exwh8Xl0J96TSYQXriTvdmrezvtRAdGjeHusftbjE0K0wbeAVYbOr2kwworSeSbR/IIGA6LCx8mNh4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710745433; c=relaxed/simple; bh=jR9gV9qoyUg8DazRVhn36W03I9zqyQRNLX6Es8FarY4=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=HnxqXzv1L8jdNNwGvw2HPagzt/EZ5iDSaZd5C05fwG99zqNXcTkOPM+90N5ANhQZq7PScy/vG+pSkuHTBSMQRg116rCE9Nd3YHVIpkjF+jv42sDloc6nzqSt9QdSb5veDoCfaEHFLDOLfMKNtyPOMtbdzc/AW2Rc2CjziSrUAWQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from [192.168.0.221] (84-115-220-185.cable.dynamic.surfer.at [84.115.220.185]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4Tym6M4RkPz3wch; Mon, 18 Mar 2024 08:03:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1710745419; bh=JZzj3ViWd+SjUx7B920dKPlk5PBd++5sDymvU/qqdfU=; h=Subject:From:To:Cc:Date; b=rrSeoxVAGG05EeUYKajUgdivbpbM+eaY8ICx/Uamry73/u9GxA3wPDjfANCvZLH9Y lJ5C7S8ixF8ZnnbobMrNfGNVOtN+Pyjna6z5BvcKr8XQpzTAbGT4GSYU1/6R0kVyQW XvXGqvP2Z0siFvdNiEPcODciEey3uVtdT+rjBjHM= Message-ID: Subject: aliasing From: Martin Uecker To: gcc@gcc.gnu.org Cc: Richard Biener Date: Mon, 18 Mar 2024 08:03:39 +0100 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.116 X-Spam-Status: No, score=-4.0 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: Hi, can you please take a quick look at this? This is intended to align the C standard with existing practice with respect to aliasing by removing the special rules for "objects with no declared type" and making it fully symmetric and only based on types with non-atomic character types being able to alias everything. Unrelated to this change, I have another question: I wonder if GCC (or any other compiler) actually exploits the " or is copied as an array of=C2=A0 byte type, " rule to=C2=A0 make assumptions about the effect= ive types of the target array? I know compilers do this work memcpy... =C2=A0 Maybe also if a loop is transformed to memcpy? Martin Add the following definition after 3.5, paragraph 2: byte array object having either no declared type or an array of objects declared with = a byte type byte type non-atomic character type Modify 6.5,paragraph 6: The effective type of an object that is not a byte array, for an access to = its stored value, is the declared type of the object.97) If a value is stored into a byte array through an lvalue having a byte type, then the type of the lvalue becomes the effective type of the object for that access and for subsequent accesses that do not modify the stored value. If a value is copied into a byte array using memcpy or memmove, or is=C2=A0 copied as an array of byte type, then the effective type of the modified object for that access and for subsequent accesses that do not modify the value is the effective type of the object from which the value is copied, if it has one. For all other accesses to a byte array, the effective type of the object is simply the type of the lvalue used for the access. https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3230.pdf