From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8357 invoked by alias); 8 Oct 2002 18:09:24 -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 8323 invoked from network); 8 Oct 2002 18:09:24 -0000 Received: from unknown (HELO localhost.localdomain) (66.60.148.227) by sources.redhat.com with SMTP; 8 Oct 2002 18:09:24 -0000 Received: from warlock.codesourcery.com (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.11.6/8.11.6) with ESMTP id g98I72l01836; Tue, 8 Oct 2002 11:07:02 -0700 Date: Tue, 08 Oct 2002 13:09:00 -0000 From: Mark Mitchell To: Janis Johnson , gcc@gcc.gnu.org Subject: Re: C++ ABI change since 3.2 with no warning Message-ID: <16730000.1034086221@localhost> In-Reply-To: <20021004161706.A17403@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-SW-Source: 2002-10/txt/msg00485.txt.bz2 --On Friday, October 04, 2002 04:17:06 PM -0700 Janis Johnson wrote: > While working on C++ compatibility tests I broke up g++.dg/init/empty1.C > into this set of source files. This test passes when everything is > built with either GCC 3.2 or with the mainline but fails when empty1_x.C > is compiled with GCC 3.2 and the rest is built with the mainline. The > original test is for a PR that was fixed in 3.0.2. The failure is due > to a change in alignment. Is this expected? I think so; we intentionally fixed the alignment of certain tiny classes, in both C and C++ on the mainline recently. If we're going to warn about it, we should do it in both C and C++. I'll take a look at it when I get home and make sure that this is what it is. -- Mark Mitchell mark@codesourcery.com CodeSourcery, LLC http://www.codesourcery.com --- empty1.h ----------------------------------------------------------- class EmptyBase0 {}; class EmptyBase1 : public EmptyBase0 {}; class Base1 { public: unsigned int t_; Base1(unsigned int); }; class PEPE : public Base1, public EmptyBase1 { public: PEPE(unsigned int); }; --- empty1_main.C ------------------------------------------------------ // Copyright (C) 2001 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 3 Sept 2001 // Split into pieces for binary compatibility testing October 2002 // Bug 4203. We were bit copying empty bases including the // padding. Which clobbers whatever they overlay. extern void empty1_x (void); int main () { empty1_x (); } --- empty1_x.C --------------------------------------------------------- extern "C" void abort (void); #include "empty1.h" void empty1_x () { PEPE pepe(0xff); if (pepe.t_ != 255) abort (); } --- empty1_y.C --------------------------------------------------------- #include "empty1.h" Base1::Base1(unsigned int t) : t_(t) {} PEPE::PEPE(unsigned int t) : Base1(t), EmptyBase1(EmptyBase1()) {} ------------------------------------------------------------------------