From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27630 invoked by alias); 25 Nov 2004 16:35:42 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 27610 invoked from network); 25 Nov 2004 16:35:38 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 25 Nov 2004 16:35:38 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id iAPGZbFr006682; Thu, 25 Nov 2004 11:35:37 -0500 Received: from pobox.toronto.redhat.com (pobox.toronto.redhat.com [172.16.14.4]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id iAPGZWr30686; Thu, 25 Nov 2004 11:35:32 -0500 Received: from vpn83-123.boston.redhat.com (IDENT:U2FsdGVkX1+dfleNwMBzzyOcpxI8wvFsMMFAEsgR4To@vpn83-123.boston.redhat.com [172.16.83.123]) by pobox.toronto.redhat.com (8.12.8/8.12.8) with ESMTP id iAPGZVoS012681; Thu, 25 Nov 2004 11:35:31 -0500 Subject: Re: [RFC] ignoring type alias conflicts between structures and scalars From: Diego Novillo To: Richard Kenner Cc: "gcc@gcc.gnu.org" In-Reply-To: <10411251622.AA06167@vlsi1.ultra.nyu.edu> References: <10411251622.AA06167@vlsi1.ultra.nyu.edu> Content-Type: text/plain Organization: Red Hat Canada Date: Thu, 25 Nov 2004 16:53:00 -0000 Message-Id: <1101400529.31231.105.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2004-11/txt/msg00974.txt.bz2 On Thu, 2004-11-25 at 11:22 -0500, Richard Kenner wrote: > If I have two pointers, one to struct_int_float and one to int, it's > certainly the case that a store into one can affect what's pointed to by the > other and that's what the alias set conflict is trying to address. > No, we have one pointer and one regular variable. I understand that an 'int *' may point to a field of 'struct int_float_s'. > So what *exactly* are you trying to test? > It's in my original message. Given: struct int_float_s { int i; int f; }; int X; foo() { struct int_float_s *x = bar(); X = 10; x->i = 3; return X; } I don't want to consider 'X = 10' and 'x->i = 3' to be stores to the same memory location. That is, I want the optimizers to assume that pointer 'x' cannot possibly be pointing to 'X'. At the moment, the fact that 'struct int_float_s' conflicts with 'int' causes us to think that 'x' may point to 'X'. So, what I want to teach the alias analyzer is that given a pointer to an aggregate type A and a regular variable of a scalar type S, such that A and S are not type-compatible, then a pointer to 'A' cannot possibly point to a variable of type 'S'. So, it boils down to alias_sets_conflict_p being symmetric. We want to consider 'int * -> struct int_float_s' to alias, but we want to reject 'struct int_float_s * -> int'. Diego.