From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28286 invoked by alias); 24 Sep 2009 10:53:27 -0000 Received: (qmail 28276 invoked by uid 22791); 24 Sep 2009 10:53:27 -0000 X-SWARE-Spam-Status: No, hits=-7.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI X-Spam-Check-By: sourceware.org Received: from cantor.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 24 Sep 2009 10:53:22 +0000 Received: from relay1.suse.de (relay-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id CD73A74609 for ; Thu, 24 Sep 2009 12:53:19 +0200 (CEST) Date: Thu, 24 Sep 2009 10:53:00 -0000 From: Richard Guenther To: gcc@gcc.gnu.org Subject: On VIEW_CONVERT_EXPRs and TBAA Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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/msg00502.txt.bz2 While looking at PR38747 again I was diving into the alias.c code and tried to confirm that it does what I think it does for VIEW_CONVERT_EXPR. And in fact it basically does. In general there are odds between what get_alias_set does if you pass it a reference tree compared to what it does if you pass it a type. In particular whether it returns the alias-set of the innermost or the outermost aliased component is not really consistent. But - onto that VIEW_CONVERT_EXPR. VIEW_CONVERT_EXPR is basically ignored / skipped, which means that if you have C++ code that does *(type2 *)&X and translate it to VIEW_CONVERT_EXPR (X) then you have generated wrong code (this is PR38747, forwprop does that). 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). The alias-oracle tries to use both the outermost and innermost alias-sets for disambiguations, but relies on the outermost alias-set being a subset of the innermost one - a relationship that V_C_E can break. 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. Thanks, Richard.