From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1483 invoked by alias); 26 Sep 2009 20:24:31 -0000 Received: (qmail 1473 invoked by uid 22791); 26 Sep 2009 20:24:30 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 26 Sep 2009 20:24:25 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id B8F6E290007; Sat, 26 Sep 2009 22:24:23 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T9GkReTcd37o; Sat, 26 Sep 2009 22:24:17 +0200 (CEST) Received: from [192.168.1.3] (83-155-193-20.rev.libertysurf.net [83.155.193.20]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 223F429000C; Sat, 26 Sep 2009 22:24:17 +0200 (CEST) From: Eric Botcazou To: Richard Guenther Subject: Re: On VIEW_CONVERT_EXPRs and TBAA Date: Sat, 26 Sep 2009 20:41:00 -0000 User-Agent: KMail/1.9.6 (enterprise 20070904.708012) Cc: gcc@gcc.gnu.org References: In-Reply-To: MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200909262226.36100.ebotcazou@adacore.com> Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-09/txt/msg00550.txt.bz2 > With VIEW_CONVERT_EXPR you can also easily create the situation > where for a reference tree, let it be VIEW_CONVERT_EXPR (X.a).b > like commonly seen in Ada, the alias-set of the outermost component > is not a subset of that of the innermost one (the relationship that > is usually assured to be true by the record_component_aliases > machinery). You are probably safe here if only your frontend generates > such conversions and it is very consistent on how it balances > V_C_Es with accesses through pointers (because in the above case > if .b is an addressable component an access via a pointer to type > of b wouldn't necessarily alias the cited reference tree). I presume you're talking exclusively about the addressable case here, because in Ada the alias set of (the type of) the outermost component is not a subset of (that of) the innermost one by default (at least for scalar types, it is for aggregate types because of implementation limitations), there being a VCE or not; the field must explicitly be declared addressable. > So, what I'd like to know is in which circumstances the Ada > frontend uses VIEW_CONVERT_EXPRs and what counter-measures it > applies to ensure consistent TBAA. The Ada compiler generates a lot of VIEW_CONVERT_EXPRs for conversions between aggregate (sub)types because it generates a lot of aggregate subtypes from a given aggregate type. These conversions are purely formal and their purpose is to ensure type consistency. The Ada compiler also uses VIEW_CONVERT_EXPR to implement up-casting type Base is tagged record I : Integer; end record; type Derived is new Base with record J : Integer; end record; D : Derived; Base (D).I is translated into VIEW_CONVERT_EXPR(d).i (a questionable use of VCE, no doubt about that). There are a few other, more obscur uses, but we get rid of the most controversial one (optimization barrier on scalars for VRP). The main countermeasure to ensure consistent TBAA is decl.c:relate_alias_sets which is aimed at doing the right thing when types are VCEd to each other. -- Eric Botcazou