This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ ABI change since 3.2 with no warning




--On Friday, October 04, 2002 04:17:06 PM -0700 Janis Johnson <janis187@us.ibm.com> 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 <nathan@codesourcery.com>
// 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()) {}
------------------------------------------------------------------------

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]