From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19523 invoked by alias); 29 Mar 2004 16:47:55 -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 19514 invoked from network); 29 Mar 2004 16:47:53 -0000 Received: from unknown (HELO boden.synopsys.com) (198.182.44.79) by sources.redhat.com with SMTP; 29 Mar 2004 16:47:53 -0000 Received: from crone.synopsys.com (crone.synopsys.com [146.225.7.23]) by boden.synopsys.com (Postfix) with ESMTP id 3C7FDDCA2; Mon, 29 Mar 2004 08:47:46 -0800 (PST) Received: from piper.synopsys.com (localhost [127.0.0.1]) by crone.synopsys.com (8.9.1/8.9.1) with ESMTP id IAA29701; Mon, 29 Mar 2004 08:47:52 -0800 (PST) Received: (from jbuck@localhost) by piper.synopsys.com (8.11.6/8.11.6) id i2TGlpv32684; Mon, 29 Mar 2004 08:47:51 -0800 X-Authentication-Warning: piper.synopsys.com: jbuck set sender to Joe.Buck@synopsys.com using -f Date: Mon, 29 Mar 2004 18:49:00 -0000 From: Joe Buck To: Nathan Sidwell Cc: Chris Lattner , Tiago Stein , gcc@gcc.gnu.org Subject: Re: Double abstract class Inheritance concern. Message-ID: <20040329084751.A32489@synopsys.com> References: <4067D6DD.1060607@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <4067D6DD.1060607@codesourcery.com>; from nathan@codesourcery.com on Mon, Mar 29, 2004 at 08:57:17AM +0100 X-SW-Source: 2004-03/txt/msg01661.txt.bz2 Chris Lattner wrote: > > I believe the reason is that the ABI does not permit multiple different > > instances of A to be located at the same address, even if they have zero > > size. If the size of the structure was 8, all of "A", "B", and "A" would > > have offset zero. > > > > I'm not sure WHY this is required, but this is the reason it happens at > > least. A declaration of "A X[100];" allocates 100 bytes as > > a result of the same rule. On Mon, Mar 29, 2004 at 08:57:17AM +0100, Nathan Sidwell wrote: > It is a C++ language requirement that no two logically distinct objects > of the same type have the same address. However, g++ still finds plenty of opportunities to allocate zero bytes for a struct/class object, when it is not adjacent to any other objects of the same type (e.g. an empty base class, or an empty data member of a struct or class).