Commit 768bf0ab by Janis Johnson Committed by Janis Johnson

README: Describe new compat directory.

2002-10-17  Janis Johnson  <janis187@us.ibm.com>

	* g++.dg/README: Describe new compat directory.
	* g++.dg/dg.exp: Skip tests in compat directory.
	* README.compat: New file.
	* lib/compat.exp: New expect script.
	* g++.dg/compat: New test directory.
	* g++.dg/compat/compat.exp: New expect script.
	* g++.dg/compat/abi: New test directory.
	* g++.dg/compat/abi/bitfield1_x.C, g++.dg/compat/abi/bitfield1_main.C,
	g++.dg/compat/abi/bitfield1_y.C, g++.dg/compat/abi/bitfield1.h,
	g++.dg/compat/abi/bitfield2_x.C, g++.dg/compat/abi/bitfield2_main.C,
	g++.dg/compat/abi/bitfield2_y.C, g++.dg/compat/abi/bitfield2.h,
	g++.dg/compat/abi/vbase8-10_x.C, g++.dg/compat/abi/vbase8-10_main.C,
	g++.dg/compat/abi/vbase8-10_y.C, g++.dg/compat/abi/vbase8-10.h,
	g++.dg/compat/abi/vbase8-21_x.C, g++.dg/compat/abi/vbase8-21_main.C,
	g++.dg/compat/abi/vbase8-21_y.C, g++.dg/compat/abi/vbase8-21.h,
	g++.dg/compat/abi/vbase8-22_x.C, g++.dg/compat/abi/vbase8-22_main.C,
	g++.dg/compat/abi/vbase8-22_y.C, g++.dg/compat/abi/vbase8-22.h,
	g++.dg/compat/abi/vbase8-4_x.C, g++.dg/compat/abi/vbase8-4_main.C,
	g++.dg/compat/abi/vbase8-4_y.C, g++.dg/compat/abi/vbase8-4.h: New files.
	* g++.dg/compat/break: New test directory.
	* g++.dg/compat/break/empty6_x.C, g++.dg/compat/break/empty6_main.C,
	g++.dg/compat/break/empty6_y.C, g++.dg/compat/break/empty6.h,
	g++.dg/compat/break/vbase10_x.C, g++.dg/compat/break/vbase10_main.C,
	g++.dg/compat/break/vbase10_y.C, g++.dg/compat/break/vbase10.h,
	g++.dg/compat/break/vbase11_x.C, g++.dg/compat/break/vbase11_main.C,
	g++.dg/compat/break/vbase11_y.C, g++.dg/compat/break/vbase11.h,
	g++.dg/compat/break/bitfield7_x.C, g++.dg/compat/break/bitfield7_main.C,
	g++.dg/compat/break/bitfield7_y.C, g++.dg/compat/break/bitfield7.h,
	g++.dg/compat/break/bitfield5_x.C, g++.dg/compat/break/bitfield5_main.C,
	g++.dg/compat/break/bitfield5_y.C, g++.dg/compat/break/bitfield5.h,
	g++.dg/compat/break/README: New files.
	* g++.dg/compat/eh: New test directory.
	* g++.dg/compat/eh/ctor1_x.C, g++.dg/compat/eh/ctor1_main.C,
	g++.dg/compat/eh/ctor1_y.C, g++.dg/compat/eh/ctor1.h,
	g++.dg/compat/eh/ctor2_x.C, g++.dg/compat/eh/ctor2_main.C,
	g++.dg/compat/eh/ctor2_y.C, g++.dg/compat/eh/ctor2.h,
	g++.dg/compat/eh/dtor1_x.C, g++.dg/compat/eh/dtor1_main.C,
	g++.dg/compat/eh/dtor1_y.C, g++.dg/compat/eh/dtor1.h,
	g++.dg/compat/eh/filter1_x.C, g++.dg/compat/eh/filter1_main.C,
	g++.dg/compat/eh/filter1_y.C, g++.dg/compat/eh/filter1.h,
	g++.dg/compat/eh/filter2_x.C, g++.dg/compat/eh/filter2_main.C,
	g++.dg/compat/eh/filter2_y.C,
	g++.dg/compat/eh/new1_x.C, g++.dg/compat/eh/new1_main.C,
	g++.dg/compat/eh/new1_y.C,
	g++.dg/compat/eh/nrv1_x.C, g++.dg/compat/eh/nrv1_main.C,
	g++.dg/compat/eh/nrv1_y.C, g++.dg/compat/eh/nrv1.h,
	g++.dg/compat/eh/spec3_x.C, g++.dg/compat/eh/spec3_main.C,
	g++.dg/compat/eh/spec3_y.C, g++.dg/compat/eh/spec3.h,
	g++.dg/compat/eh/template1_x.C, g++.dg/compat/eh/template1_main.C,
	g++.dg/compat/eh/template1_y.C, g++.dg/compat/eh/template1.h,
	g++.dg/compat/eh/unexpected1_x.C, g++.dg/compat/eh/unexpected1_main.C,
	g++.dg/compat/eh/unexpected1_y.C: New files.
	* g++.dg/compat/init: New test directory.
	* g++.dg/compat/init/array5_x.C, g++.dg/compat/init/array5_main.C,
	g++.dg/compat/init/array5_y.C,
	g++.dg/compat/init/byval1_x.C, g++.dg/compat/init/byval1_main.C,
	g++.dg/compat/init/byval1_y.C, g++.dg/compat/init/byval1.h,
	g++.dg/compat/init/dtor1_x.C, g++.dg/compat/init/dtor1_main.C,
	g++.dg/compat/init/dtor1_y.C, g++.dg/compat/init/dtor1.h,
	g++.dg/compat/init/elide1_x.C, g++.dg/compat/init/elide1_main.C,
	g++.dg/compat/init/elide1_y.C, g++.dg/compat/init/elide1.h,
	g++.dg/compat/init/init-ref2_x.C, g++.dg/compat/init/init-ref2_main.C,
	g++.dg/compat/init/init-ref2_y.C: New files.

From-SVN: r58266
parent fa870451
2002-10-17 Janis Johnson <janis187@us.ibm.com>
* g++.dg/README: Describe new compat directory.
* g++.dg/dg.exp: Skip tests in compat directory.
* README.compat: New file.
* lib/compat.exp: New expect script.
* g++.dg/compat: New test directory.
* g++.dg/compat/compat.exp: New expect script.
* g++.dg/compat/abi: New test directory.
* g++.dg/compat/abi/bitfield1_x.C, g++.dg/compat/abi/bitfield1_main.C,
g++.dg/compat/abi/bitfield1_y.C, g++.dg/compat/abi/bitfield1.h,
g++.dg/compat/abi/bitfield2_x.C, g++.dg/compat/abi/bitfield2_main.C,
g++.dg/compat/abi/bitfield2_y.C, g++.dg/compat/abi/bitfield2.h,
g++.dg/compat/abi/vbase8-10_x.C, g++.dg/compat/abi/vbase8-10_main.C,
g++.dg/compat/abi/vbase8-10_y.C, g++.dg/compat/abi/vbase8-10.h,
g++.dg/compat/abi/vbase8-21_x.C, g++.dg/compat/abi/vbase8-21_main.C,
g++.dg/compat/abi/vbase8-21_y.C, g++.dg/compat/abi/vbase8-21.h,
g++.dg/compat/abi/vbase8-22_x.C, g++.dg/compat/abi/vbase8-22_main.C,
g++.dg/compat/abi/vbase8-22_y.C, g++.dg/compat/abi/vbase8-22.h,
g++.dg/compat/abi/vbase8-4_x.C, g++.dg/compat/abi/vbase8-4_main.C,
g++.dg/compat/abi/vbase8-4_y.C, g++.dg/compat/abi/vbase8-4.h: New files.
* g++.dg/compat/break: New test directory.
* g++.dg/compat/break/empty6_x.C, g++.dg/compat/break/empty6_main.C,
g++.dg/compat/break/empty6_y.C, g++.dg/compat/break/empty6.h,
g++.dg/compat/break/vbase10_x.C, g++.dg/compat/break/vbase10_main.C,
g++.dg/compat/break/vbase10_y.C, g++.dg/compat/break/vbase10.h,
g++.dg/compat/break/vbase11_x.C, g++.dg/compat/break/vbase11_main.C,
g++.dg/compat/break/vbase11_y.C, g++.dg/compat/break/vbase11.h,
g++.dg/compat/break/bitfield7_x.C, g++.dg/compat/break/bitfield7_main.C,
g++.dg/compat/break/bitfield7_y.C, g++.dg/compat/break/bitfield7.h,
g++.dg/compat/break/bitfield5_x.C, g++.dg/compat/break/bitfield5_main.C,
g++.dg/compat/break/bitfield5_y.C, g++.dg/compat/break/bitfield5.h,
g++.dg/compat/break/README: New files.
* g++.dg/compat/eh: New test directory.
* g++.dg/compat/eh/ctor1_x.C, g++.dg/compat/eh/ctor1_main.C,
g++.dg/compat/eh/ctor1_y.C, g++.dg/compat/eh/ctor1.h,
g++.dg/compat/eh/ctor2_x.C, g++.dg/compat/eh/ctor2_main.C,
g++.dg/compat/eh/ctor2_y.C, g++.dg/compat/eh/ctor2.h,
g++.dg/compat/eh/dtor1_x.C, g++.dg/compat/eh/dtor1_main.C,
g++.dg/compat/eh/dtor1_y.C, g++.dg/compat/eh/dtor1.h,
g++.dg/compat/eh/filter1_x.C, g++.dg/compat/eh/filter1_main.C,
g++.dg/compat/eh/filter1_y.C, g++.dg/compat/eh/filter1.h,
g++.dg/compat/eh/filter2_x.C, g++.dg/compat/eh/filter2_main.C,
g++.dg/compat/eh/filter2_y.C,
g++.dg/compat/eh/new1_x.C, g++.dg/compat/eh/new1_main.C,
g++.dg/compat/eh/new1_y.C,
g++.dg/compat/eh/nrv1_x.C, g++.dg/compat/eh/nrv1_main.C,
g++.dg/compat/eh/nrv1_y.C, g++.dg/compat/eh/nrv1.h,
g++.dg/compat/eh/spec3_x.C, g++.dg/compat/eh/spec3_main.C,
g++.dg/compat/eh/spec3_y.C, g++.dg/compat/eh/spec3.h,
g++.dg/compat/eh/template1_x.C, g++.dg/compat/eh/template1_main.C,
g++.dg/compat/eh/template1_y.C, g++.dg/compat/eh/template1.h,
g++.dg/compat/eh/unexpected1_x.C, g++.dg/compat/eh/unexpected1_main.C,
g++.dg/compat/eh/unexpected1_y.C: New files.
* g++.dg/compat/init: New test directory.
* g++.dg/compat/init/array5_x.C, g++.dg/compat/init/array5_main.C,
g++.dg/compat/init/array5_y.C,
g++.dg/compat/init/byval1_x.C, g++.dg/compat/init/byval1_main.C,
g++.dg/compat/init/byval1_y.C, g++.dg/compat/init/byval1.h,
g++.dg/compat/init/dtor1_x.C, g++.dg/compat/init/dtor1_main.C,
g++.dg/compat/init/dtor1_y.C, g++.dg/compat/init/dtor1.h,
g++.dg/compat/init/elide1_x.C, g++.dg/compat/init/elide1_main.C,
g++.dg/compat/init/elide1_y.C, g++.dg/compat/init/elide1.h,
g++.dg/compat/init/init-ref2_x.C, g++.dg/compat/init/init-ref2_main.C,
g++.dg/compat/init/init-ref2_y.C: New files.
2002-10-17 Mark Mitchell <mark@codesourcery.com> 2002-10-17 Mark Mitchell <mark@codesourcery.com>
PR c++/7584 PR c++/7584
......
Compatibility test suites that use lib/compat.exp test interoperability
of two compilers that follow the same ABI, or of multiple sets of
compiler options that are not intended to affect binary compatibility.
They do not test conformance to a formal ABI; they check that things are
done consistently, not that they are done correctly. They are meant to
complement ABI test suites, not to replace them.
Each test in these suites splits up functionality into two source files
that can be compiled with two different versions of GCC and with two
sets of compiler options.
Override the default pairs of compiler options (from compat.exp) by
defining the environment variable COMPAT_OPTIONS as:
COMPAT_OPTIONS="[list [list {tst1} {alt1}]...[list {tstn} {altn}]]"
where tsti and alti are lists of options, with "tsti" used by the
compiler under test and "alti" used by the alternate compiler. The
characters "[", "{", "}", and "]" are really in the string, as in
"[list [list {-g} {-O3}] [list {-O3} {-g}]]".
To use an alternate compiler, define the environment variable for the
language you're testing; e.g., for C++ define ALT_CXX_UNDER_TEST to be
the full pathname of an installed compiler. That will be written to
the site.exp file used by DejaGNU. The default is to build each test
with the compiler under test using the first of each pair of compiler
options from COMPAT_OPTIONS. When ALT_CXX_UNDER_TEST is "same", each
test is built using the compiler under test but with combinations of
the options from COMPAT_OPTIONS.
A test that fails when the pieces are compiled with different compilers
but passes when the pieces are compiled with the same compiler
demonstrates incompatibility of the generated code or runtime support.
A test that fails for the alternate compiler but passes for the compiler
under test probably tests for a fix that is not present in the alternate
compiler.
There's a lot more that can be done with these tests.
Increase the robustness of the existing tests:
- recognize target triples in dg-options strings in test files
- continue to split up tests that rely on language runtime support
and add them to this set of tests
- make sure they work for testing with a simulator
- multilibs support?
Build test pieces into more combinations that will be likely to find
unusual errors:
- link using the alternate compiler; this requires support for
LD_LIBRARY_PATH for the alternate compiler in the support for each
language
- build pieces of the test into shared libraries; this requires
support for LD_LIBRARY_PATH for the alternate compiler, and
knowledge about how to build a shared library for each target
- build pieces of the test into static libraries; this requires
knowledge about how to build a static library for each target
Continue to add tests to g++.dg/compat, based on existing tests for
language runtime support and for test cases in PRs that didn't used to
fit into the test suite.
Set up similar tests in libstdc++-v3/testsuite.
Set up similar tests for additional languages and libraries.
Janis Johnson, <janis187@us.ibm.com>
October 2002
Subdirectories: Subdirectories:
abi Tests for ABI compatibility -- mangling, object layout, etc. abi Tests for ABI compatibility -- mangling, object layout, etc.
compat Tests for binary compatibility (consistency, not ABI conformance)
cpp Tests for the preprocessor. cpp Tests for the preprocessor.
eh Tests for exception handling. eh Tests for exception handling.
expr Tests for expressions. expr Tests for expressions.
......
typedef int Int;
typedef signed int SInt;
typedef unsigned int UInt;
struct A
{
SInt bitS : 1; // signed
UInt bitU : 1; // unsigned
Int bit : 1; // signedness by -f{signed,unsigned}-bitfields
};
// { dg-options "-ansi -pedantic-errors -funsigned-bitfields" }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 15 Dec 2001 <nathan@codesourcery.com>
// Split into pieces for binary compatibility testing October 2002
extern void bitfield1_x (void);
int
main ()
{
bitfield1_x ();
}
#include "bitfield1.h"
extern void bitfield1_y (A& a);
void bitfield1_x ()
{
A a;
a.bitS = 1;
a.bitU = 1;
a.bit = 1;
bitfield1_y (a);
}
extern "C" void abort (void);
#include "bitfield1.h"
void bitfield1_y (A& a)
{
if (a.bitS != -1)
abort ();
if (a.bitU != 1)
abort ();
if (a.bit != 1)
abort ();
}
typedef int Int;
typedef signed int SInt;
typedef unsigned int UInt;
struct A
{
SInt bitS : 1; // signed
UInt bitU : 1; // unsigned
Int bit : 1; // signedness by -f{signed,unsigned}-bitfields
};
// { dg-options "-ansi -pedantic-errors -fsigned-bitfields" }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 15 Dec 2001 <nathan@codesourcery.com>
// Split into pieces for binary compatibility testing October 2002
extern void bitfield1_x (void);
int
main ()
{
bitfield1_x ();
}
#include "bitfield1.h"
extern void bitfield1_y (A& a);
void bitfield1_x ()
{
A a;
a.bitS = 1;
a.bitU = 1;
a.bit = 1;
bitfield1_y (a);
}
extern "C" void abort (void);
#include "bitfield1.h"
void bitfield1_y (A& a)
{
if (a.bitS != -1)
abort ();
if (a.bitU != 1)
abort ();
if (a.bit != -1)
abort ();
}
class C0
{ public: int i0; };
class C1
: public C0
{ public: int i1; };
class C2
: public C1
, virtual public C0
{ public: int i2; };
class C3
: public C1
, public C2
, virtual public C0
{ public: int i3; };
class C4
: virtual public C1
, virtual public C0
, virtual public C3
, public C2
{ public: int i4; };
class C5
: public C3
, virtual public C0
, virtual public C2
{ public: int i5; };
class C6
: public C1
, public C2
, virtual public C5
, virtual public C3
, virtual public C0
{ public: int i6; };
class C7
: public C1
, virtual public C5
, virtual public C4
, virtual public C2
, virtual public C0
, virtual public C6
{ public: int i7; };
class C8
: virtual public C4
, public C3
, public C0
, virtual public C7
, virtual public C6
{ public: int i8; };
class C9
: virtual public C0
, public C4
, public C8
, public C1
, public C6
{ public: int i9; };
// { dg-options -w }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 Jul 2001 <nathan@codesourcery.com>
// Split into pieces for binary compatibility testing October 2002
// Origin stefan@space.twc.de
// Bug 3145 case 10. Horribly complicated class hierarchy
extern void vbase8_10_x (void);
int
main ()
{
vbase8_10_x ();
}
#include "vbase8-10.h"
extern void check_C0 (C0&, int);
extern void check_C1 (C1&, int);
extern void check_C2 (C2&, int);
extern void check_C3 (C3&, int);
extern void check_C4 (C4&, int);
extern void check_C5 (C5&, int);
extern void check_C6 (C6&, int);
extern void check_C7 (C7&, int);
extern void check_C8 (C8&, int);
extern void check_C9 (C9&, int);
void
vbase8_10_x (void)
{
C0 c0;
C1 c1;
C2 c2;
C3 c3;
C4 c4;
C5 c5;
C6 c6;
C7 c7;
C8 c8;
C9 c9;
c0.i0 = 0;
c1.i1 = 101;
c2.i2 = 202;
c3.i3 = 303;
c4.i4 = 404;
c5.i5 = 505;
c6.i6 = 606;
c7.i7 = 707;
c8.i8 = 808;
c9.i9 = 909;
check_C0 (c0, 0);
check_C1 (c1, 101);
check_C2 (c2, 202);
check_C3 (c3, 303);
check_C4 (c4, 404);
check_C5 (c5, 505);
check_C6 (c6, 606);
check_C7 (c7, 707);
check_C8 (c8, 808);
check_C9 (c9, 909);
}
extern "C" void abort (void);
#include "vbase8-10.h"
void check_C0 (C0 &x, int i)
{
if (x.i0 != i)
abort ();
}
void check_C1 (C1 &x, int i)
{
if (x.i1 != i)
abort ();
}
void check_C2 (C2 &x, int i)
{
if (x.i2 != i)
abort ();
}
void check_C3 (C3 &x, int i)
{
if (x.i3 != i)
abort ();
}
void check_C4 (C4 &x, int i)
{
if (x.i4 != i)
abort ();
}
void check_C5 (C5 &x, int i)
{
if (x.i5 != i)
abort ();
}
void check_C6 (C6 &x, int i)
{
if (x.i6 != i)
abort ();
}
void check_C7 (C7 &x, int i)
{
if (x.i7 != i)
abort ();
}
void check_C8 (C8 &x, int i)
{
if (x.i8 != i)
abort ();
}
void check_C9 (C9 &x, int i)
{
if (x.i9 != i)
abort ();
}
class C0
{ public: int i0; };
class C1
: virtual public C0
{ public: int i1; };
class C2
: virtual public C1
, virtual public C0
{ public: int i2; };
class C3
: virtual public C2
, virtual public C1
{ public: int i3; };
class C4
: virtual public C2
, public C0
, public C1
{ public: int i4; };
class C5
: virtual public C0
, public C2
, virtual public C1
, virtual public C3
, virtual public C4
{ public: int i5; };
class C6
: virtual public C1
, virtual public C3
, public C0
, public C2
, virtual public C4
{ public: int i6; };
class C7
: virtual public C5
, public C2
, public C6
, virtual public C0
, public C3
{ public: int i7; };
class C8
: virtual public C5
, public C7
, virtual public C0
, virtual public C2
, virtual public C6
{ public: int i8; };
class C9
: virtual public C2
, virtual public C4
, public C1
, virtual public C0
, public C7
, public C5
{ public: int i9; };
// { dg-options -w }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 Jul 2001 <nathan@codesourcery.com>
// Split into pieces for binary compatibility testing October 2002
// Origin stefan@space.twc.de
// Bug 3145 case 10. Horribly complicated class hierarchy
extern void vbase8_21_x (void);
int
main ()
{
vbase8_21_x ();
}
#include "vbase8-21.h"
extern void check_C0 (C0&, int);
extern void check_C1 (C1&, int);
extern void check_C2 (C2&, int);
extern void check_C3 (C3&, int);
extern void check_C4 (C4&, int);
extern void check_C5 (C5&, int);
extern void check_C6 (C6&, int);
extern void check_C7 (C7&, int);
extern void check_C8 (C8&, int);
extern void check_C9 (C9&, int);
void
vbase8_21_x (void)
{
C0 c0;
C1 c1;
C2 c2;
C3 c3;
C4 c4;
C5 c5;
C6 c6;
C7 c7;
C8 c8;
C9 c9;
c0.i0 = 0;
c1.i1 = 101;
c2.i2 = 202;
c3.i3 = 303;
c4.i4 = 404;
c5.i5 = 505;
c6.i6 = 606;
c7.i7 = 707;
c8.i8 = 808;
c9.i9 = 909;
check_C0 (c0, 0);
check_C1 (c1, 101);
check_C2 (c2, 202);
check_C3 (c3, 303);
check_C4 (c4, 404);
check_C5 (c5, 505);
check_C6 (c6, 606);
check_C7 (c7, 707);
check_C8 (c8, 808);
check_C9 (c9, 909);
}
extern "C" void abort (void);
#include "vbase8-21.h"
void check_C0 (C0 &x, int i)
{
if (x.i0 != i)
abort ();
}
void check_C1 (C1 &x, int i)
{
if (x.i1 != i)
abort ();
}
void check_C2 (C2 &x, int i)
{
if (x.i2 != i)
abort ();
}
void check_C3 (C3 &x, int i)
{
if (x.i3 != i)
abort ();
}
void check_C4 (C4 &x, int i)
{
if (x.i4 != i)
abort ();
}
void check_C5 (C5 &x, int i)
{
if (x.i5 != i)
abort ();
}
void check_C6 (C6 &x, int i)
{
if (x.i6 != i)
abort ();
}
void check_C7 (C7 &x, int i)
{
if (x.i7 != i)
abort ();
}
void check_C8 (C8 &x, int i)
{
if (x.i8 != i)
abort ();
}
void check_C9 (C9 &x, int i)
{
if (x.i9 != i)
abort ();
}
class C0
{ public: int i0; };
class C1
: public C0
{ public: int i1; };
class C2
: public C1
, virtual public C0
{ public: int i2; };
class C3
: virtual public C0
, virtual public C2
, virtual public C1
{ public: int i3; };
class C4
: virtual public C2
, public C1
, virtual public C3
, public C0
{ public: int i4; };
class C5
: virtual public C0
, virtual public C4
, public C1
, virtual public C2
, virtual public C3
{ public: int i5; };
class C6
: public C0
, virtual public C1
, public C5
, public C2
, virtual public C3
, virtual public C4
{ public: int i6; };
class C7
: virtual public C1
, public C5
, virtual public C6
, virtual public C4
, virtual public C3
, virtual public C0
{ public: int i7; };
class C8
: virtual public C6
, virtual public C1
, virtual public C2
, public C3
, virtual public C4
{ public: int i8; };
class C9
: public C4
, virtual public C2
, virtual public C8
, public C3
, public C1
, public C6
, public C5
{ public: int i9; };
// { dg-options -w }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 20 Nov 2001 <nathan@codesourcery.com>
// Split into pieces for binary compatibility testing October 2002
// Origin stefan@space.twc.de
// Bug 3145 case 22. Horribly complicated class hierarchy
extern void vbase8_22_x (void);
int
main ()
{
vbase8_22_x ();
}
#include "vbase8-22.h"
extern void check_C0 (C0&, int);
extern void check_C1 (C1&, int);
extern void check_C2 (C2&, int);
extern void check_C3 (C3&, int);
extern void check_C4 (C4&, int);
extern void check_C5 (C5&, int);
extern void check_C6 (C6&, int);
extern void check_C7 (C7&, int);
extern void check_C8 (C8&, int);
extern void check_C9 (C9&, int);
void
vbase8_22_x (void)
{
C0 c0;
C1 c1;
C2 c2;
C3 c3;
C4 c4;
C5 c5;
C6 c6;
C7 c7;
C8 c8;
C9 c9;
c0.i0 = 0;
c1.i1 = 101;
c2.i2 = 202;
c3.i3 = 303;
c4.i4 = 404;
c5.i5 = 505;
c6.i6 = 606;
c7.i7 = 707;
c8.i8 = 808;
c9.i9 = 909;
check_C0 (c0, 0);
check_C1 (c1, 101);
check_C2 (c2, 202);
check_C3 (c3, 303);
check_C4 (c4, 404);
check_C5 (c5, 505);
check_C6 (c6, 606);
check_C7 (c7, 707);
check_C8 (c8, 808);
check_C9 (c9, 909);
}
extern "C" void abort (void);
#include "vbase8-22.h"
void check_C0 (C0 &x, int i)
{
if (x.i0 != i)
abort ();
}
void check_C1 (C1 &x, int i)
{
if (x.i1 != i)
abort ();
}
void check_C2 (C2 &x, int i)
{
if (x.i2 != i)
abort ();
}
void check_C3 (C3 &x, int i)
{
if (x.i3 != i)
abort ();
}
void check_C4 (C4 &x, int i)
{
if (x.i4 != i)
abort ();
}
void check_C5 (C5 &x, int i)
{
if (x.i5 != i)
abort ();
}
void check_C6 (C6 &x, int i)
{
if (x.i6 != i)
abort ();
}
void check_C7 (C7 &x, int i)
{
if (x.i7 != i)
abort ();
}
void check_C8 (C8 &x, int i)
{
if (x.i8 != i)
abort ();
}
void check_C9 (C9 &x, int i)
{
if (x.i9 != i)
abort ();
}
class C0
{ public: int i0; };
class C1
: virtual public C0
{ public: int i1; };
class C2
: public C0
, public C1
{ public: int i2; };
class C3
: virtual public C0
, public C1
, public C2
{ public: int i3; };
class C4
: public C2
, public C3
, virtual public C1
, virtual public C0
{ public: int i4; };
class C5
: virtual public C2
, public C1
, public C0
{ public: int i5; };
class C6
: virtual public C0
, virtual public C5
, public C1
, public C3
, public C4
{ public: int i6; };
class C7
: public C6
, virtual public C0
, public C1
, public C2
, virtual public C4
{ public: int i7; };
class C8
: public C2
, virtual public C6
, virtual public C7
, public C5
, public C3
, virtual public C4
{ public: int i8; };
class C9
: public C5
, virtual public C3
, virtual public C8
, public C0
, public C2
, public C7
, public C6
, public C4
{ public: int i9; };
// { dg-options -w }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 20 Nov 2001 <nathan@codesourcery.com>
// Split into pieces for binary compatibility testing October 2002
// Origin stefan@space.twc.de
// Bug 3145 case 4. Horribly complicated class hierarchy
extern void vbase8_4_x (void);
int
main ()
{
vbase8_4_x ();
}
#include "vbase8-4.h"
extern void check_C0 (C0&, int);
extern void check_C1 (C1&, int);
extern void check_C2 (C2&, int);
extern void check_C3 (C3&, int);
extern void check_C4 (C4&, int);
extern void check_C5 (C5&, int);
extern void check_C6 (C6&, int);
extern void check_C7 (C7&, int);
extern void check_C8 (C8&, int);
extern void check_C9 (C9&, int);
void
vbase8_4_x (void)
{
C0 c0;
C1 c1;
C2 c2;
C3 c3;
C4 c4;
C5 c5;
C6 c6;
C7 c7;
C8 c8;
C9 c9;
c0.i0 = 0;
c1.i1 = 101;
c2.i2 = 202;
c3.i3 = 303;
c4.i4 = 404;
c5.i5 = 505;
c6.i6 = 606;
c7.i7 = 707;
c8.i8 = 808;
c9.i9 = 909;
check_C0 (c0, 0);
check_C1 (c1, 101);
check_C2 (c2, 202);
check_C3 (c3, 303);
check_C4 (c4, 404);
check_C5 (c5, 505);
check_C6 (c6, 606);
check_C7 (c7, 707);
check_C8 (c8, 808);
check_C9 (c9, 909);
}
extern "C" void abort (void);
#include "vbase8-4.h"
void check_C0 (C0 &x, int i)
{
if (x.i0 != i)
abort ();
}
void check_C1 (C1 &x, int i)
{
if (x.i1 != i)
abort ();
}
void check_C2 (C2 &x, int i)
{
if (x.i2 != i)
abort ();
}
void check_C3 (C3 &x, int i)
{
if (x.i3 != i)
abort ();
}
void check_C4 (C4 &x, int i)
{
if (x.i4 != i)
abort ();
}
void check_C5 (C5 &x, int i)
{
if (x.i5 != i)
abort ();
}
void check_C6 (C6 &x, int i)
{
if (x.i6 != i)
abort ();
}
void check_C7 (C7 &x, int i)
{
if (x.i7 != i)
abort ();
}
void check_C8 (C8 &x, int i)
{
if (x.i8 != i)
abort ();
}
void check_C9 (C9 &x, int i)
{
if (x.i9 != i)
abort ();
}
Tests in this directory are for functionality that has changed in GCC
from one release to another or that is not ABI-compliant and may change
in a future release.
Each test header for changed behavior should indicate the version in
which the behavior changed, in order to help users of these tests to
determine whether a test failure is expected or not.
Every test in this directory that covers behavior that is not
ABI-compliant should also be covered by a test for -Wabi to ensure that
there is a warning for the construct.
struct A {
virtual void f();
int f1 : 1;
};
struct B : public A {
int f2 : 1;
int : 0;
int f3 : 4;
int f4 : 3;
};
// The offset of `B::f2' is not ABI-compliant and may change in a future
// version of GCC.
// g++.dg/abi/bitfield5.C tests this with -Wabi.
// Split into pieces for binary compatibility testing October 2002
#include "bitfield5.h"
extern void bitfield5_x (void);
int
main ()
{
bitfield5_x ();
}
#include "bitfield5.h"
extern void bitfield5_y (B&);
void bitfield5_x ()
{
B b;
b.f3 = 7;
b.f4 = 3;
bitfield5_y (b);
}
extern "C" void abort (void);
#include "bitfield5.h"
void A::f () {}
void bitfield5_y (B& b)
{
if (b.f3 != 7)
abort ();
if (b.f4 != 3)
abort ();
}
// { dg-options "-w" }
// The size assigned to `U' may not be ABI-compliant and may change in a
// future version of GCC.
// g++.dg/abi/bitfield7.C tests this with -Wabi.
// Split into pieces for binary compatibility testing October 2002
#include "bitfield7.h"
extern void bitfield7_x (void);
int
main ()
{
bitfield7_x ();
}
#include "bitfield7.h"
extern void bitfield7_y (U*);
void bitfield7_x ()
{
U u[2];
u[0].i = 7;
u[1].i = 8;
bitfield7_y (u);
}
extern "C" void abort (void);
#include "bitfield7.h"
void bitfield7_y (U* u)
{
if (u[0].i != 7)
abort ();
if (u[1].i != 8)
abort ();
}
struct A {};
struct B {
A a;
virtual void f () {}
int i;
};
// `B::a' contains empty classes which may cause base classes to be
// placed at different locations in a future version of GCC.
// g++.dg/abi/empty6.C tests this with -Wabi.
// Split into pieces for binary compatibility testing October 2002
#include "empty6.h"
extern void empty6_x (void);
int
main ()
{
empty6_x ();
}
#include "empty6.h"
extern void empty6_y (B&);
void empty6_x ()
{
B b;
b.i = 7;
empty6_y (b);
}
extern "C" void abort (void);
#include "empty6.h"
void empty6_y (B& b)
{
if (b.i != 7)
abort ();
}
struct A {
virtual void f();
char c1;
};
struct B {
B();
char c2;
};
struct C : public A, public virtual B {
};
// The offset of virtual base `B' is not ABI-compliant and may change in
// a future version of GCC.
// g++.dg/abi/vbase10.C tests this with -Wabi.
// Split into pieces for binary compatibility testing October 2002
#include "vbase10.h"
extern void vbase10_x (void);
int
main ()
{
vbase10_x ();
}
#include "vbase10.h"
extern void vbase10_y (C&);
void vbase10_x ()
{
C c;
c.c1 = 1;
c.c2 = 2;
vbase10_y (c);
}
extern "C" void abort (void);
#include "vbase10.h"
void A::f () {}
B::B() {}
void vbase10_y (C& c)
{
if (c.c1 != 1)
abort ();
if (c.c2 != 2)
abort ();
}
struct base
{
short b;
virtual int foo();
};
struct derived: virtual base
{
int d;
virtual int foo();
virtual int bar();
};
// Test case from PR 7470, which was fixed in GCC 3.2 and breaks binary
// compatibility with earlier releases.
// Split into pieces for binary compatibility testing October 2002
#include "vbase11.h"
extern void vbase11_x (void);
int
main ()
{
vbase11_x ();
}
#include "vbase11.h"
extern void vbase11_y (derived&);
int base::foo() { return 1; }
int derived::foo() { return 2; }
int derived::bar() { return 3; }
void vbase11_x ()
{
derived d;
vbase11_y (d);
}
extern "C" void abort (void);
#include "vbase11.h"
void vbase11_y (derived& d)
{
if (d.foo() != 2)
abort ();
if (d.bar() != 3)
abort ();
}
# Copyright (C) 2002 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# This file was written by Janis Johnson, <janis187@us.ibm.com>
# Test interoperability of two compilers that follow the same ABI.
#
# Break simple tests into two pieces and see that they work when linked
# together. If an alternate compiler is specified then the two main
# pieces of each test are compiled with different compilers. The
# alternate compiler must be installed, and is specified by defining
# ALT_CXX_UNDER_TEST in the environment.
if $tracelevel then {
strace $tracelevel
}
global GXX_UNDER_TEST
global ld_library_path
# Load procedures from common libraries.
load_lib standard.exp
load_lib g++.exp
#
# compat-fix-library-path -- switch LD_LIBRARY_PATH
#
proc compat-fix-library-path { } {
global ld_library_path
# See comments in lib/g++.exp for why this is needed.
setenv LD_LIBRARY_PATH $ld_library_path
setenv SHLIB_PATH $ld_library_path
setenv LD_LIBRARYN32_PATH $ld_library_path
setenv LD_LIBRARY64_PATH $ld_library_path
}
#
# compat-use-alt-compiler -- make the alternate compiler the default
#
proc compat-use-alt-compiler { } {
global GXX_UNDER_TEST ALT_CXX_UNDER_TEST
global CXXFLAGS
global ALWAYS_CXXFLAGS
global ld_library_path alt_ld_library_path
global same_alt
# We don't need to do this if the alternate compiler is actually
# the same as the compiler under test.
if { $same_alt == 0 } then {
set GXX_UNDER_TEST $ALT_CXX_UNDER_TEST
set CXXFLAGS ""
set ALWAYS_CXXFLAGS ""
set ld_library_path $alt_ld_library_path
compat-fix-library-path
}
}
#
# compat-use-tst-compiler -- make compiler under test the default
#
proc compat-use-tst-compiler { } {
global GXX_UNDER_TEST save_gxx_under_test
global CXXFLAGS save_cxxflags
global ALWAYS_CXXFLAGS save_always_cxxflags
global ld_library_path save_ld_library_path
global same_alt
# We don't need to do this if the alternate compiler is actually
# the same as the compiler under test.
if { $same_alt == 0 } then {
set GXX_UNDER_TEST $save_gxx_under_test
set CXXFLAGS $save_cxxflags
set ALWAYS_CXXFLAGS $save_always_cxxflags
set ld_library_path $save_ld_library_path
compat-fix-library-path
}
}
# Load the language-independent compabibility support procedures.
# This must be done after the compat-use-*-compiler definitions.
load_lib compat.exp
g++_init
# Save variables for the C++ compiler under test, which each test will
# change a couple of times. This must be done after calling g++-init.
set save_gxx_under_test $GXX_UNDER_TEST
set save_cxxflags $CXXFLAGS
set save_always_cxxflags $ALWAYS_CXXFLAGS
set save_ld_library_path $ld_library_path
# Find out whether there is an alternate compiler to test. If the
# variable is defined but is set to "same", that means we use the same
# compiler twice, which is meaningful if the two parts of COMPAT_OPTIONS
# are different.
set use_alt 0
set same_alt 0
set alt_ld_library_path "."
if [info exists ALT_CXX_UNDER_TEST] then {
set use_alt 1
if [string match "same" $ALT_CXX_UNDER_TEST] then {
set same_alt 1
} else {
if [info exists ALT_LD_LIBRARY_PATH] then {
append alt_ld_library_path ":${ALT_LD_LIBRARY_PATH}"
}
}
}
# Main loop.
foreach src [lsort [find $srcdir/$subdir *_main.C]] {
# If we're only testing specific files and this isn't one of them, skip it.
if ![runtest_file_p $runtests $src] then {
continue
}
compat-execute $src $use_alt
}
# Restore the original compiler under test.
compat-use-tst-compiler
struct Foo
{
~Foo ();
};
struct Bar
{
~Bar ();
Foo f;
};
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 26 Dec 2001 <nathan@nathan@codesourcery.com>
// PR 411
// Split into pieces for binary compatibility testing October 2002
extern void ctor1_x (void);
int
main ()
{
ctor1_x ();
}
extern "C" void abort (void);
extern "C" void exit (int);
#include "ctor1.h"
bool was_f_in_Bar_destroyed=false;
void ctor1_x ()
{
try
{
Bar f;
}
catch(int i)
{
if(was_f_in_Bar_destroyed)
{
exit (0);
}
}
abort ();
}
extern bool was_f_in_Bar_destroyed;
#include "ctor1.h"
Foo::~Foo()
{
was_f_in_Bar_destroyed=true;
}
Bar::~Bar()
{
throw 1;
}
struct VBase
{
virtual void f () {}
VBase();
~VBase();
};
struct StreamBase
{
virtual ~StreamBase() {}
};
struct Stream : public virtual VBase, public StreamBase
{
Stream();
virtual ~Stream() {}
};
struct DerivedStream : public Stream
{
DerivedStream();
};
// PR c++/4460
// Test that the cleanup for fully-constructed subobjects when a
// constructor throws gets the right address for a virtual base.
// Split into pieces for binary compatibility testing October 2002
extern void ctor2_x (void);
int main ()
{
ctor2_x ();
}
extern "C" void exit (int);
extern "C" void abort (void);
#include "ctor2.h"
int r;
void ctor2_x () {
try
{
DerivedStream str;
}
catch (...) { }
if (r != 0)
abort ();
exit (0);
}
extern int r;
void *p;
#include "ctor2.h"
VBase::VBase ()
{
p = this;
}
VBase::~VBase ()
{
if (p != this) r = 1;
}
Stream::Stream () {}
DerivedStream::DerivedStream ()
{
throw 1;
}
struct A {
~A();
};
struct B: public A {
~B();
};
// PR c++/411
// Test that a fully-constructed base is destroyed before transferring
// control to the handler of a function-try-block.
// Split into pieces for binary compatibility testing October 2002
extern void dtor1_x (void);
int
main ()
{
dtor1_x ();
}
extern "C" void exit (int);
extern "C" void abort (void);
#include "dtor1.h"
int r;
void dtor1_x ()
{
{ B b; }
if (r != 0)
abort ();
exit (0);
}
extern int r;
int ad;
#include "dtor1.h"
A::~A () { ++ad; }
B::~B ()
try
{
throw 1;
}
catch (...)
{
if (!ad)
r = 1;
return;
}
// Test that cleanups get run when a catch filter fails to match.
// Split into pieces for binary compatibility testing October 2002
extern void filter1_x (void);
int
main ()
{
filter1_x ();
}
#include "filter1.h"
extern "C" void exit (int);
extern "C" void abort (void);
extern void ex_test (void);
void
filter1_x ()
{
try
{
ex_test ();
}
catch (...)
{
}
abort ();
}
a::a() { }
a::~a() { exit (0); }
#include "filter1.h"
struct e1 {};
struct e2 {};
void
ex_test ()
{
a aa;
try
{
throw e1 ();
}
catch (e2 &)
{
}
}
// Test that terminate gets run when a catch filter fails to match while
// running destructors. Original bug depended on a::~a being inlined.
// Split into pieces for binary compatibility testing October 2002
extern void filter2_x (void);
int
main ()
{
filter2_x ();
}
#include <exception>
#include <cstdlib>
extern void my_terminate (void);
extern void ex_test (void);
void
filter2_x ()
{
std::set_terminate (my_terminate);
try
{
ex_test ();
}
catch (...)
{
}
abort ();
}
#include <exception>
#include <cstdlib>
struct e1 {};
struct e2 {};
struct a
{
a () { }
~a ()
{
try
{
throw e1();
}
catch (e2 &)
{
}
}
};
void
ex_test ()
{
a aa;
try
{
throw e1 ();
}
catch (e2 &)
{
}
}
void my_terminate ()
{
std::exit (0);
}
// PR c++/5757
// Test that when a constructor throws in a new-expression, we pass the
// right pointer to operator delete.
// Split into pieces for binary compatibility testing October 2002
extern void new1_x (void);
int
main ()
{
new1_x ();
}
#include <new>
extern "C" void exit (int);
extern "C" void abort (void);
extern void * operator new[] (size_t s) throw (std::bad_alloc);
extern void operator delete[] (void *p) throw ();
struct A
{
A() { throw 1; }
~A() {}
};
int ret = 1;
void
new1_x ()
{
try
{
A *p = new A[4];
}
catch (...) {}
if (ret != 0)
abort ();
exit (0);
}
#include <new>
extern int ret;
void *ptr;
void * operator new[] (size_t s) throw (std::bad_alloc)
{
ptr = operator new (s);
return ptr;
}
void operator delete[] (void *p) throw ()
{
if (p == ptr)
ret = 0;
operator delete (p);
}
// PR c++/5636
// Bug: the named return value optimization interfered with EH cleanups.
// Split into pieces for binary compatibility testing October 2002
extern void nrv1_x (void);
int
main ()
{
nrv1_x ();
}
extern "C" void exit (int);
extern "C" void abort (void);
#include "nrv1.h"
extern A f (void);
int c, d;
void nrv1_x ()
{
try
{ A a = f(); }
catch (...) { }
if (d < c)
abort ();
exit (0);
}
A::A() { ++c; }
A::~A() { ++d; }
#include "nrv1.h"
A f()
{
A nrv;
throw 42;
return nrv;
}
class Base {};
struct A : virtual public Base
{
A();
};
struct B {};
// PR c++/4381
// Test that exception-specs work properly for classes with virtual bases.
// Split into pieces for binary compatibility testing October 2002
extern void spec3_x (void);
int
main ()
{
spec3_x ();
}
#include "spec3.h"
extern void func () throw (B,A);
void spec3_x (void)
{
try { func(); }
catch (A& a) { }
}
#include "spec3.h"
A::A() {}
void func() throw (B,A)
{
throw A();
}
class A {};
template <class T>
struct B
{
typedef A E;
};
template <class T>
struct C
{
typedef B<T> D;
typedef typename D::E E;
void f() throw(E);
};
// Test whether exception specifier dependent on template parameter
// is accepted during template decl processing.
// Split into pieces for binary compatibility testing October 2002
extern void template1_x (void);
int
main ()
{
template1_x ();
}
extern "C" void exit (int);
extern "C" void abort (void);
#include "template1.h"
void template1_x ()
{
int caught = 0;
try
{
C<int> x;
x.f();
}
catch (A)
{
++caught;
}
if (caught != 1)
abort ();
exit (0);
}
#include "template1.h"
template<class T> void C<T>::f (void) throw (E)
{
throw E();
}
template class C<int>;
// PR 3719
// Test that an unexpected handler can rethrow to categorize.
// Split into pieces for binary compatibility testing October 2002
extern void unexpected1_x ();
int
main ()
{
unexpected1_x ();
}
#include <exception>
struct One { };
struct Two { };
extern "C" void abort ();
extern void doit (void) throw (Two);
extern void handle_unexpected (void);
void
unexpected1_x ()
{
std::set_unexpected (handle_unexpected);
try
{
doit ();
}
catch (Two &)
{
}
catch (...)
{
abort ();
}
}
struct One { };
struct Two { };
void
handle_unexpected ()
{
try
{
throw;
}
catch (One &)
{
throw Two ();
}
}
void
doit () throw (Two)
{
throw One ();
}
// Copyright (C) 2002 Free Software Foundation
// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
// Split into pieces for binary compatibility testing October 2002
// Incorrect construction and destruction of multi-dimensional
// array of class.
extern void array5_x (void);
int
main ()
{
array5_x ();
}
extern "C" void abort (void);
extern int count;
extern int num;
struct A
{
A();
~A();
};
struct Array
{
A array[2][2][2];
};
void
array5_x ()
{
for (num = 0; num <= 8; ++num)
{
count = 0;
try
{
Array A;
}
catch (...)
{
}
if (count != 0)
abort();
}
}
int count;
int num;
struct A
{
A();
~A();
};
A::A()
{
if (count == num)
throw "";
count++;
}
A::~A()
{
count--;
}
struct C
{
int m;
C();
~C();
};
// PR c++/3948
// Test that the destructor call for a value parameter gets the
// right address.
// Split into pieces for binary compatibility testing October 2002
extern void byval1_x (void);
int
main ()
{
byval1_x ();
}
#include "byval1.h"
extern "C" void abort (void);
extern void Foo (C c);
extern int r;
void
byval1_x ()
{
C c;
Foo (c);
if (r != 0)
abort ();
}
#include "byval1.h"
void *p[2];
int i;
int r;
C::C() { p[i++] = this; }
C::~C() { if (p[--i] != this) r = 1; }
void Foo (C c)
{
p[i++] = &c;
}
struct B
{
int x;
B (int);
~B ();
};
struct C1 : public B {
C1 (int);
};
struct C2 : public B {
C2 (int);
};
struct D : public B {
D (int);
};
struct E : public B {
E (int);
};
struct A
: public C1, C2, virtual public D, virtual public E
{
A ();
B x1;
B x2;
};
// Split into pieces for binary compatibility testing October 2002
extern void dtor1_x (void);
int
main ()
{
dtor1_x ();
}
#include "dtor1.h"
void
dtor1_x (void)
{
A a;
}
#include "dtor1.h"
extern "C" void abort ();
int d = 5;
B::B (int i) : x (i) { }
B::~B () { if (d-- != x) abort (); }
C1::C1 (int i) : B (i) {}
C2::C2 (int i) : B (i) {}
D::D (int i) : B (i) {}
E::E (int i) : B (i) {}
A::A () : D (0), E (1), C1 (2), C2 (3), x1(4), x2(5) {}
struct A {
A ();
A (const A&);
~A ();
};
// Test that the destructor for a temporary passed by value isn't run
// until end of full-expression, as per [class.copy]:
// Whenever a temporary class object is copied using a copy constructor,
// and this object and the copy have the same cv-unqualified type, an
// implementation is permitted to treat the original and the copy as two
// different ways of referring to the same object and not perform a copy
// at all, even if the class copy constructor or destructor have side
// effects.... In these cases, the
// object is destroyed at the later of times when the original and the
// copy would have been destroyed without the optimization.
// Here, the temporary would be destroyed later than the parm, so either we
// must suppress the optimization in this case or destroy value parms in the
// caller.
// Split into pieces for binary compatibility testing October 2002
extern void elide1_x (void);
int
main ()
{
elide1_x ();
}
#include "elide1.h"
extern "C" void abort (void);
extern void f (A);
extern int d;
void
elide1_x (void)
{
int r;
f (A ()), r = d;
if (r >= d || !d)
abort ();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment