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]

C++ ABI change since 3.2 with no warning


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?  Should it get a warning
with -Wabi for having changed since GCC 3.2?

Janis

--- 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]