From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30680 invoked by alias); 18 Feb 2011 10:32:32 -0000 Received: (qmail 30670 invoked by uid 22791); 18 Feb 2011 10:32:31 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Feb 2011 10:32:26 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1IAWP2u001555 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 18 Feb 2011 05:32:25 -0500 Received: from zebedee.pink (ovpn-113-145.phx2.redhat.com [10.3.113.145]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1IAWOB6013614; Fri, 18 Feb 2011 05:32:25 -0500 Message-ID: <4D5E4AB7.4030603@redhat.com> Date: Fri, 18 Feb 2011 10:40:00 -0000 From: Andrew Haley User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7 MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Re: alias question References: <425734.7938.qm@web130222.mail.mud.yahoo.com> In-Reply-To: <425734.7938.qm@web130222.mail.mud.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-02/txt/msg00280.txt.bz2 On 02/18/2011 10:02 AM, xorbe wrote: > >>> If I have a char array, and it's always written by the char array, >>> can it be always reliably read by any combination of >>> short/int/long pointers? >>> >>> As I understand, the compiler will see byte writes for all types, >>> so readind shoulg be fine without violating any strict alias >>> rules. Just can't write the array by any other type than char[] >>> access. Right? >> >> No. You can access anything only as its declared type >> or character type; >> an array of char thus can be accessed as char only. > > However, what I said is walking the fine line of following > that rule. I have several overlapping read-only types, BUT > they are only written as char. Hence, they'll always resolve > to the correct value. I haven't been able to construct any > code which fails to work yet. If a char write precedes a > type's access to the same location, then it will be seen. > As far as I can tell, that basic rule is followed here! I think not, but you haven't described what you're doing with sufficient precision for us to be able to tell for sure. Andrew.