public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mark Mitchell <mark@codesourcery.com>
To: Janis Johnson <janis187@us.ibm.com>, gcc@gcc.gnu.org
Subject: Re: C++ ABI change since 3.2 with no warning
Date: Tue, 08 Oct 2002 13:09:00 -0000	[thread overview]
Message-ID: <16730000.1034086221@localhost> (raw)
In-Reply-To: <20021004161706.A17403@us.ibm.com>



--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()) {}
------------------------------------------------------------------------ 

      reply	other threads:[~2002-10-08 18:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-04 17:02 Janis Johnson
2002-10-08 13:09 ` Mark Mitchell [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16730000.1034086221@localhost \
    --to=mark@codesourcery.com \
    --cc=gcc@gcc.gnu.org \
    --cc=janis187@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).