From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28235 invoked by alias); 17 Oct 2004 22:25:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 28192 invoked from network); 17 Oct 2004 22:25:36 -0000 Received: from unknown (HELO vlsi1.ultra.nyu.edu) (128.122.140.213) by sourceware.org with SMTP; 17 Oct 2004 22:25:36 -0000 Received: by vlsi1.ultra.nyu.edu (4.1/1.34) id AA01784; Sun, 17 Oct 04 18:29:23 EDT Date: Sun, 17 Oct 2004 22:30:00 -0000 From: kenner@vlsi1.ultra.nyu.edu (Richard Kenner) Message-Id: <10410172229.AA01784@vlsi1.ultra.nyu.edu> To: zack@codesourcery.com Subject: Re: [patch] for PR 18040 Cc: gcc-patches@gcc.gnu.org X-SW-Source: 2004-10/txt/msg01424.txt.bz2 > ... actually, it's not good enough because it doesn't handle the > ((cast) var).field > case and that's an expensive one. My gut feeling is that needing this cast means there's something wrong with the static type of VAR. Could you show an example of source code that needs this cast, and the type tree generated for VAR? Well, in Ada you can get it with an explicit Unchecked_Conversion to a composite type. For example: with unchecked_conversion; function foo return integer is type arr is array (1..100_000) of integer; type r is record f1: length; f2: array (1..99_999) of integer; end record; var: foo; begin return uc (foo).f1 + foo (2000); end foo; The type of FOO has to be an array of 100,000 integers, but the programmer would be quite surprised if the reference to F1 involved a 400,000 byte copy! This is, admittedly, a somewhat contrived example, but this sort of thing occurs commonly in expanded code for different constructs.