OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/gnu-old/gcc-4.2.2/gcc/testsuite/g++.old-deja/g++.abi
    from Rev 154 to Rev 816
    Reverse comparison

Rev 154 → Rev 816

/vbase8-9.C
0,0 → 1,77
// { dg-do run }
// { dg-options "-ansi -pedantic-errors -w" }
 
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 14 Jun 2001 <nathan@codesourcery.com>
 
// Bug 3145, generated by script provided by stefan@space.twc.de
// This is case number 9
 
class C0
{};
class C1
: public C0
{};
class C2
: public C1
, public C0
{};
class C3
: virtual public C0
, public C2
, virtual public C1
{};
class C4
: virtual public C2
, public C0
, virtual public C3
, public C1
{};
class C5
: public C0
, public C1
, public C4
, virtual public C2
, public C3
{};
class C6
: public C1
, public C3
, virtual public C5
, virtual public C2
, public C0
, virtual public C4
{};
class C7
: virtual public C1
, virtual public C0
, public C6
, virtual public C2
, public C5
{};
class C8
: virtual public C1
, virtual public C4
, public C0
, virtual public C7
, virtual public C2
{};
class C9
: virtual public C1
, virtual public C6
, public C8
, virtual public C2
, public C0
{};
int main() {
C0 c0;
C1 c1;
C2 c2;
C3 c3;
C4 c4;
C5 c5;
C6 c6;
C7 c7;
C8 c8;
C9 c9;
}
vbase8-9.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: empty.C =================================================================== --- empty.C (nonexistent) +++ empty.C (revision 816) @@ -0,0 +1,69 @@ +// { dg-do run } +// { dg-options "-w" } +// Origin: Mark Mitchell + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 + +struct S0 +{ +}; + +struct S1 : public S0 +{ +}; + +struct S2 : public S1 +{ + char c; +}; + +// In S3, the S1 instance is allocated first at offset zero. The S2 +// instance has to be allocated at a subsequent offset; it's first +// part is also an S1. + +struct S3 : public S1, public S2 +{ +}; + +struct S4 +{ + int i; +}; + +// In S4, in contrast to S3, S2 is allocated first, and S1 can be +// allocated on top of S4. + +struct S5 : public S2, public S1, public S4 +{ +}; + +// The T classes are by-hand layouts that should be equivalent to the +// S classes. + +struct T3 +{ + S1 s1; + S2 s2; +}; + +struct T5 +{ + S2 s2; + S4 s4; +}; + +int main () +{ + if (sizeof (S3) != sizeof (T3)) + return 1; + else if (sizeof (S5) != sizeof (T5)) + return 2; +} + +#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ + +int main () +{ +} + +#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
empty.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: layout1.C =================================================================== --- layout1.C (nonexistent) +++ layout1.C (revision 816) @@ -0,0 +1,52 @@ +// { dg-do run } +// Origin: Mark Mitchell + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 + +struct R +{ + virtual void r (); +}; + +struct S +{ + virtual void f (); +}; + +struct T : virtual public S +{ + virtual void g (); +}; + +struct U : public R, virtual public T +{ + virtual void h (); +}; + +struct V : public R, virtual public S, virtual public T +{ + virtual void v (); +}; + +struct U1 +{ + R r; + T t; +}; + +int main () +{ + if (sizeof (U) != sizeof (U1)) + return 1; + if (sizeof (V) != sizeof (U1)) + return 2; +} + +#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ + +int main () +{ +} + +#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ +
layout1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable2.C =================================================================== --- vtable2.C (nonexistent) +++ vtable2.C (revision 816) @@ -0,0 +1,213 @@ +// { dg-do run } +// { dg-options "-fno-strict-aliasing" } +// Origin: Mark Mitchell + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 + +#include + +struct S0 +{ + virtual void s0 (); +}; + +struct S1 : virtual public S0 +{ + virtual void s1 (); +}; + +struct S2 : virtual public S1 +{ + virtual void s1 (); + virtual void s0 (); +}; + +struct S3 +{ + virtual void s3 (); +}; + +struct S4 : public S3, virtual public S2 +{ + virtual void s1 (); +}; + +void S0::s0 () +{ +} + +void S1::s1 () +{ +} + +void S2::s1 () +{ +} + +void S2::s0 () +{ +} + +void S3::s3 () +{ +} + +void S4::s1 () +{ +} + +/* The vtables should look like: + + S0 primary vtable + + S0 offset to top + S0 RTTI + S0::s0 + + ================= + + S1 primary vtable + + S0::s0 vcall offset + S0 vbase offset + S1 offset to top + S1 RTTI + S0::s0 + S1::s1 + + ================= + + S2 primary vtable + + S2::s1 vcall offset + S1 vbase offset + S2::s0 vcall offset + S0 vbase offset + S2 offset to top + S2 RTTI + S2::s0 + S2::s1 + + ================= + + S3 primary vtable + + S3 offset to top + S3 RTTI + S3::s3 + + ================= + + S4 primary vtable + + vbase offset for S0 + vbase offset for S1 + vbase offset for S2 + S4 offset to top + S4 RTTI + S3::s3 + S4::s1 + + S2-in-S4 secondary vtable + + S1 vbase offset + S4::s1 vcall offset + S0 vbase offset + S2:s0 vcall offset + S2 offset to top + S4 RTTI + S2::s0 + S4::s1 + +*/ + +// These are tricks to allow us to get raw function pointers for +// member functions. +extern "C" { + /* We can use weakref here without dg-require-weak, because we know + the symbols are defined, so we don't actually issue the .weak + directives. */ + static void S3_s3 () __attribute__((__weakref__ ("_ZN2S32s3Ev"))); + static void S4_s1 () __attribute__((__weakref__ ("_ZN2S42s1Ev"))); +} + +// IA-64 uses function descriptors not function pointers in its vtables. +#if defined __ia64__ +#define CMP_VPTR(A, B) (*(void **)(A) == *(void **)(B)) +#ifdef _LP64 +#define INC_VPTR(A) ((A) += 2) +#define INC_VDATA(A,N) ((A) += (N)) +#else +#define INC_VPTR(A) ((A) += 4) +#define INC_VDATA(A,N) ((A) += 2*(N)) +#endif +#else +#define CMP_VPTR(A, B) (*(A) == (ptrdiff_t)(B)) +#define INC_VPTR(A) ((A) += 1) +#define INC_VDATA(A,N) ((A) += (N)) +#endif + +int main () +{ + S4 s4; + ptrdiff_t **vptr; + ptrdiff_t *vtbl; + + // Set vtbl to point at the beginning of S4's primary vtable. + vptr = (ptrdiff_t **) &s4; + vtbl = *vptr; + INC_VDATA (vtbl, -5); + + if (*vtbl != ((char*) (S0*) &s4) - (char*) &s4) + return 1; + INC_VDATA (vtbl, 1); + if (*vtbl != ((char*) (S1*) &s4) - (char*) &s4) + return 2; + INC_VDATA (vtbl, 1); + if (*vtbl != ((char*) (S2*) &s4) - (char*) &s4) + return 3; + INC_VDATA (vtbl, 1); + if (*vtbl != 0) + return 4; + INC_VDATA (vtbl, 1); + // Skip the RTTI entry. + INC_VDATA (vtbl, 1); + if (! CMP_VPTR (vtbl, &S3_s3)) + return 5; + INC_VPTR (vtbl); + if (! CMP_VPTR (vtbl, &S4_s1)) + return 6; + INC_VPTR (vtbl); + // The S1 vbase offset. + if (*vtbl != 0) + return 7; + INC_VDATA (vtbl, 1); + // The S4::s1 vcall offset is negative; once you convert to S2, you + // have to convert to S4 to find the final overrider. + if (*vtbl != ((char*) &s4 - (char*) (S2*) &s4)) + return 8; + INC_VDATA (vtbl, 1); + if (*vtbl != 0) + return 9; + INC_VDATA (vtbl, 1); + if (*vtbl != 0) + return 10; + INC_VDATA (vtbl, 1); + // Now we're at the S2 offset to top entry. + if (*vtbl != ((char*) &s4 - (char*) (S2*) &s4)) + return 11; + INC_VDATA (vtbl, 1); + // Skip the RTTI entry. + INC_VDATA (vtbl, 1); + // Skip the remaining virtual functions -- they are thunks. + INC_VPTR (vtbl); + INC_VPTR (vtbl); +} + +#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ + +int main () +{ +} + +#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
vtable2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable3a.C =================================================================== --- vtable3a.C (nonexistent) +++ vtable3a.C (revision 816) @@ -0,0 +1,23 @@ +// { dg-do run } +// { dg-additional-files "vtable3.h" } + +// Copyright (C) 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check constructor vtables work. + +#define A_EMPTY +#define B1_EMPTY +#define B2_EMPTY +#define C_EMPTY +#define C_PARENTS B1, B2 + +#include "vtable3.h" + +/* + A = { vptr } + B1, B2 = { A } + C = { B1, B2 } + D = { C } + D1 = { + */
vtable3a.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable3b.C =================================================================== --- vtable3b.C (nonexistent) +++ vtable3b.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-additional-files "vtable3.h" } + +// Copyright (C) 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check constructor vtables work. + +#define B1_EMPTY +#define B2_EMPTY +#define C_EMPTY +#define C_PARENTS B1, B2 + +#include "vtable3.h"
vtable3b.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable3c.C =================================================================== --- vtable3c.C (nonexistent) +++ vtable3c.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-additional-files "vtable3.h" } + +// Copyright (C) 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check constructor vtables work. + +#define A_EMPTY +#define B2_EMPTY +#define C_EMPTY +#define C_PARENTS B1, B2 + +#include "vtable3.h"
vtable3c.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable3d.C =================================================================== --- vtable3d.C (nonexistent) +++ vtable3d.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-additional-files "vtable3.h" } + +// Copyright (C) 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check constructor vtables work. + +#define A_EMPTY +#define B1_EMPTY +#define C_EMPTY +#define C_PARENTS B1, B2 + +#include "vtable3.h"
vtable3d.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: primary2.C =================================================================== --- primary2.C (nonexistent) +++ primary2.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do run } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check primary bases are chosen correctly. + +struct A {virtual void Foo () {}}; +struct B : virtual A {}; +struct C : virtual B {}; +struct D : virtual B, virtual C {}; + +int main () +{ + D d; + +#if __GXX_ABI_VERSION >= 100 + if (sizeof (D) != sizeof (A)) + return 1; +#endif + + return 0; +}
primary2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable3e.C =================================================================== --- vtable3e.C (nonexistent) +++ vtable3e.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-additional-files "vtable3.h" } + +// Copyright (C) 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check constructor vtables work. + +#define A_EMPTY +#define B1_EMPTY +#define B2_EMPTY +#define C_PARENTS B1, B2 + +#include "vtable3.h"
vtable3e.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: primary3.C =================================================================== --- primary3.C (nonexistent) +++ primary3.C (revision 816) @@ -0,0 +1,45 @@ +// { dg-do run } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check primary bases are chosen correctly. + +struct A {virtual void Foo () {}}; +struct B1 : virtual A {}; +struct B2 : virtual A {}; +struct C : virtual B1, B2 {}; +struct D : virtual C {}; + +int main () +{ + C c; + D d; + + A *apc = &c; + B1 *b1pc = &c; + B2 *b2pc = &c; + + A *apd = &d; + B1 *b1pd = &d; + B2 *b2pd = &d; + C *cpd = &d; + +#if __GXX_ABI_VERSION >= 100 + if (static_cast (apc) != static_cast (b1pc)) + return 1; + if (static_cast (&c) != static_cast (b2pc)) + return 2; + if (static_cast (b1pc) == static_cast (b2pc)) + return 3; + + if (static_cast (apd) != static_cast (b1pd)) + return 11; + if (static_cast (b2pd) != static_cast (&d)) + return 12; + if (static_cast (b2pd) != static_cast (cpd)) + return 13; + if (static_cast (b1pd) == static_cast (b2pd)) + return 14; +#endif + return 0; +}
primary3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable3f.C =================================================================== --- vtable3f.C (nonexistent) +++ vtable3f.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-additional-files "vtable3.h" } + +// Copyright (C) 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check constructor vtables work. + +#define A_EMPTY +#define B1_EMPTY +#define B2_EMPTY +#define C_EMPTY +#define C_PARENTS B1, virtual B2 + +#include "vtable3.h"
vtable3f.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: primary4.C =================================================================== --- primary4.C (nonexistent) +++ primary4.C (revision 816) @@ -0,0 +1,28 @@ +// { dg-do run } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check primary bases are chosen correctly. + +struct A { virtual void Foo () {}}; + +struct B1 : virtual A {}; +struct B2 : virtual A {}; + +struct C : virtual B1 {}; + +struct D : virtual B1, B2, C {}; + +int main () +{ + D d; + A *ap = &d; + C *cp = &d; + +#if __GXX_ABI_VERSION >= 100 + if (static_cast (ap) != static_cast (cp)) + return 1; +#endif + + return 0; +}
primary4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable3g.C =================================================================== --- vtable3g.C (nonexistent) +++ vtable3g.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-additional-files "vtable3.h" } + +// Copyright (C) 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check constructor vtables work. + +#define A_EMPTY +#define B1_EMPTY +#define B2_EMPTY +#define C_EMPTY +#define C_PARENTS virtual B1, B2 + +#include "vtable3.h"
vtable3g.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable3h.C =================================================================== --- vtable3h.C (nonexistent) +++ vtable3h.C (revision 816) @@ -0,0 +1,15 @@ +// { dg-do run } +// { dg-additional-files "vtable3.h" } + +// Copyright (C) 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check constructor vtables work. + +#define A_EMPTY +#define B1_EMPTY +#define B2_EMPTY +#define C_EMPTY +#define C_PARENTS virtual B1, virtual B2 + +#include "vtable3.h"
vtable3h.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: cxa_vec.C =================================================================== --- cxa_vec.C (nonexistent) +++ cxa_vec.C (revision 816) @@ -0,0 +1,285 @@ +// { dg-do run { xfail powerpc-ibm-aix* } } +// { dg-options "-flat_namespace" { target *-*-darwin[67]* } } +// Test __cxa_vec routines +// Copyright (C) 2000, 2005 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 7 Apr 2000 + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 +#include +#include +#include +#include +#include + +static int ctor_count = 0; +static int dtor_count = 0; +static bool dtor_repeat = false; + +// Allocate enough padding to hold an array cookie. +#ifdef __ARM_EABI__ +#define padding 8 +#else +#define padding (sizeof (std::size_t)) +#endif + +// our pseudo ctors and dtors +static abi::__cxa_cdtor_return_type ctor (void *x) +{ + if (!ctor_count) + throw 1; + ctor_count--; +#ifdef __ARM_EABI__ + return x; +#endif +} + +static abi::__cxa_cdtor_return_type dtor (void *x) +{ + if (!dtor_count) + { + if (!dtor_repeat) + dtor_count--; + throw 1; + } + dtor_count--; +#ifdef __ARM_EABI__ + return x; +#endif +} + +// track new and delete +static int blocks = 0; +void *operator new[] (std::size_t size) throw (std::bad_alloc) +{ + void *ptr = malloc (size); + + if (!ptr) + throw std::bad_alloc (); + blocks++; + return ptr; +} + +void operator delete[] (void *ptr) throw () +{ + if (ptr) + { + free (ptr); + blocks--; + } +} +static jmp_buf jump; + +// allocate and delete an array with no problems +void test0 () +{ + static bool started = false; + + if (!started) + { + started = true; + std::set_terminate (test0); + + ctor_count = dtor_count = 5; + dtor_repeat = false; + blocks = 0; + + try + { + void *ary = abi::__cxa_vec_new (5, 1, padding, ctor, dtor); + abi::__cxa_vec_delete (ary, 1, padding, dtor); + if (ctor_count || dtor_count || blocks) + longjmp (jump, 1); + } + catch (...) + { + longjmp (jump, 2); + } + } + else + { + longjmp (jump, 3); + } + return; +} + +// allocate and delete an array with exception on ctor +void test1 () +{ + static bool started = false; + + if (!started) + { + started = true; + std::set_terminate (test1); + + ctor_count = dtor_count = 5; + dtor_repeat = false; + blocks = 0; + + ctor_count = 4; + try + { + void *ary = abi::__cxa_vec_new (5, 1, padding, ctor, dtor); + longjmp (jump, 1); + } + catch (...) + { + // we expect to get here + if (ctor_count || dtor_count != 1 || blocks) + longjmp (jump, 2); + } + } + else + { + longjmp (jump, 3); + } + return; +} + +// allocate and delete an array with exception on dtor +void test2 () +{ + static bool started = false; + + if (!started) + { + started = true; + std::set_terminate (test2); + ctor_count = dtor_count = 5; + dtor_repeat = false; + blocks = 0; + + dtor_count = 3; + try + { + void *ary = abi::__cxa_vec_new (5, 1, padding, ctor, dtor); + abi::__cxa_vec_delete (ary, 1, padding, dtor); + longjmp (jump, 1); + } + catch (...) + { + // we expect to get here + if (ctor_count || dtor_count != -2u || blocks) + longjmp (jump, 2); + } + } + else + { + longjmp (jump, 3); + } + return; +} + +// allocate an array with double exception on dtor +void test3 () +{ + static bool started = false; + + if (!started) + { + started = true; + std::set_terminate (test3); + + ctor_count = dtor_count = 5; + dtor_repeat = false; + blocks = 0; + + dtor_count = 3; + dtor_repeat = true; + try + { + void *ary = abi::__cxa_vec_new (5, 1, padding, ctor, dtor); + abi::__cxa_vec_delete (ary, 1, padding, dtor); + longjmp (jump, 1); + } + catch (...) + { + // we do not expect to get here + longjmp (jump, 2); + } + } + else + { + // we expect to get here (via terminate) + if (ctor_count || dtor_count || blocks != 1) + longjmp (jump, 3); + longjmp (jump, -1); + } + return; +} + +// allocate an array with exception on ctor and exception in cleanup +void test4 () +{ + static bool started = false; + + if (!started) + { + started = true; + std::set_terminate (test4); + + ctor_count = dtor_count = 5; + dtor_repeat = false; + blocks = 0; + + ctor_count = 3; + dtor_count = 2; + try + { + void *ary = abi::__cxa_vec_new (5, 1, padding, ctor, dtor); + longjmp (jump, 1); + } + catch (...) + { + // we do not expect to get here + longjmp (jump, 2); + } + } + else + { + // we expect to get here (via terminate) + if (ctor_count || dtor_count != -1u || blocks != 1) + longjmp (jump, 3); + longjmp (jump, -1); + } + return; +} + +static void (*tests[])() = +{ + test0, + test1, + test2, + test3, + test4, + NULL +}; + +int main () +{ + int ix; + int n; + int errors = 0; + + for (ix = 0; tests[ix]; ix++) + { + if (n = setjmp (jump)) + { + if (n > 0) + { + printf ("test %d failed %d\n", ix, n); + errors++; + } + } + else + tests[ix] (); + } + return errors; +} + +#else +int main () +{ + return 0; +} +#endif
cxa_vec.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: primary5.C =================================================================== --- primary5.C (nonexistent) +++ primary5.C (revision 816) @@ -0,0 +1,37 @@ +// { dg-do run } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check primary bases are chosen correctly. + +struct A1 +{ + virtual void Foo () {}; +}; + +struct A : A1 +{ +}; + +struct B : A +{ +}; + +struct C : virtual B +{ +}; + +struct D : virtual B, virtual C +{ +}; + +int main() +{ + D d; +#if __GXX_ABI_VERSION >= 100 + if (sizeof (D) != sizeof (A)) + return 1; +#endif + + return 0; +}
primary5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable3i.C =================================================================== --- vtable3i.C (nonexistent) +++ vtable3i.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-additional-files "vtable3.h" } + +// Copyright (C) 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check constructor vtables work. + +#define B1_EMPTY +#define B2_EMPTY +#define C_EMPTY +#define C_PARENTS virtual B1, B2 + +#include "vtable3.h"
vtable3i.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable3j.C =================================================================== --- vtable3j.C (nonexistent) +++ vtable3j.C (revision 816) @@ -0,0 +1,14 @@ +// { dg-do run } +// { dg-additional-files "vtable3.h" } + +// Copyright (C) 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check constructor vtables work. + +#define B1_EMPTY +#define B2_EMPTY +#define C_EMPTY +#define C_PARENTS virtual B1, virtual B2 + +#include "vtable3.h"
vtable3j.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable.C =================================================================== --- vtable.C (nonexistent) +++ vtable.C (revision 816) @@ -0,0 +1,83 @@ +// { dg-do run } +// { dg-options "-fno-strict-aliasing" } +// Test various aspects of vtable layout. +// Origin: Mark Mitchell + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 + +struct S0 +{ + virtual void h () + { + } + + int k; +}; + + +struct S1 +{ + virtual void f () + { + } + + int i; +}; + +struct S2 : virtual public S0 +{ + virtual void g () + { + } + + int j; +}; + +struct S3 +{ + virtual void k () + { + } + + int l; +}; + +struct S4 : public virtual S1, public S2, public S3 +{ +}; + +inline void* vtable (void *object) +{ + // The vptr is always the first part of the object. + return * (void **) object; +} + +int main () +{ + // The vtable layout order for S4 should consist of S4's primary + // vtable (shared with S2), followed by the vtable for S3 (because + // it is a non-virtual base). Then, these should be followed by the + // the vtables for S1 and S0, which are virtual. + S4 s4; + S0 *s0 = &s4; + S1 *s1 = &s4; + S2 *s2 = &s4; + S3 *s3 = &s4; + + if (vtable (&s4) != vtable (s2)) + return 1; + if (vtable (s2) >= vtable (s3)) + return 2; + if (vtable (s3) >= vtable (s1)) + return 3; + if (vtable (s1) >= vtable (s0)) + return 4; +} + +#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ + +int main () +{ +} + +#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
vtable.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vmihint.C =================================================================== --- vmihint.C (nonexistent) +++ vmihint.C (revision 816) @@ -0,0 +1,71 @@ +// { dg-do run } +// Test rtti hint flags +// Copyright (C) 2000, 2003 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 3 Apr 2000 + +#include + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 +#include + +struct A {int m;}; +struct A1vA : virtual A {int m;}; +struct A2vA : virtual A {int m;}; +struct A1A : A {int m;}; +struct A2A : A {int m;}; +struct B {int m;}; + +struct C1 : B, virtual A {int m;}; + +struct D1 : A1vA, A2vA {int m;}; + +struct E1 : A1A, A2A {int m;}; + +struct E2 : A1A, A2vA {int m;}; + +struct F1 : A1A, A1vA, A2vA {int m;}; + +struct P1 : protected A {int m;}; + +struct P2 : B, P1 {int m;}; + +using namespace abi; + +int expect (int flags, std::type_info const &info) +{ + abi::__vmi_class_type_info const *ptr = + dynamic_cast (&info); + if (!ptr) + return 0; + if (ptr->__flags != flags) + return 0; + return 1; +} + +int main () +{ + if (! expect (0, typeid (C1))) + return 1; + if (! expect (2, typeid (D1))) + return 2; + if (! expect (1, typeid (E1))) + return 3; + if (! expect (1, typeid (E2))) + return 4; + if (! expect (3, typeid (F1))) + return 5; + + if (!expect (0, typeid (P1))) + return 6; + if (!expect (0, typeid (P2))) + return 7; + + return 0; +} + +#else +int main () +{ + return 0; +} +#endif
vmihint.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: empty2.C =================================================================== --- empty2.C (nonexistent) +++ empty2.C (revision 816) @@ -0,0 +1,136 @@ +// { dg-do assemble } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 12 Apr 2001 + +// Check we deal with trailing empty base classes properly + +struct A {}; +struct B1 : A {}; +struct B2 : A {}; +struct B3 : A {}; +struct B4 : A {}; +struct B5 : A {}; +struct B6 : A {}; +struct B7 : A {}; +struct B8 : A {}; + +struct C1 : B1 +{ + virtual void Foo () {}; +}; +struct C2 : B1, B2 +{ + virtual void Foo () {}; +}; +struct C3 : B1, B2, B3 +{ + virtual void Foo () {}; +}; +struct C4 : B1, B2, B3, B4 +{ + virtual void Foo () {}; +}; +struct C5 : B1, B2, B3, B4, B5 +{ + virtual void Foo () {}; +}; +struct C6 : B1, B2, B3, B4, B5, B6 +{ + virtual void Foo () {}; +}; +struct C7 : B1, B2, B3, B4, B5, B6, B7 +{ + virtual void Foo () {}; +}; +struct C8 : B1, B2, B3, B4, B5, B6, B7, B8 +{ + virtual void Foo () {}; +}; + +struct D1 : virtual C1 {}; +struct D2 : virtual C2 {}; +struct D3 : virtual C3 {}; +struct D4 : virtual C4 {}; +struct D5 : virtual C5 {}; +struct D6 : virtual C6 {}; +struct D7 : virtual C7 {}; +struct D8 : virtual C8 {}; + +unsigned const nearly_empty_size = sizeof (D1); + +template int Check (Dn const &ref) +{ + if ((sizeof (Cn) <= nearly_empty_size) + != (static_cast (&ref) + == static_cast (&ref))) + return 1; + return 0; +} + +template int Check () +{ + Cn c[2]; + + if (static_cast (static_cast (&c[1])) + == static_cast (static_cast (&c[0]))) + return 1; + return 0; +} + + +int main () +{ +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 + if (Check ()) + return 1; + if (Check ()) + return 2; + if (Check ()) + return 3; + if (Check ()) + return 4; + if (Check ()) + return 5; + if (Check ()) + return 6; + if (Check ()) + return 7; + if (Check ()) + return 8; + + if (Check (D1 ())) + return 11; + if (Check (D2 ())) + return 12; + if (Check (D3 ())) + return 13; + if (Check (D4 ())) + return 14; + if (Check (D5 ())) + return 15; + if (Check (D6 ())) + return 16; + if (Check (D7 ())) + return 17; + if (Check (D8 ())) + return 18; + + if (sizeof (C2) == nearly_empty_size) + return 22; + if (sizeof (C3) == nearly_empty_size) + return 23; + if (sizeof (C4) == nearly_empty_size) + return 24; + if (sizeof (C5) == nearly_empty_size) + return 25; + if (sizeof (C6) == nearly_empty_size) + return 26; + if (sizeof (C7) == nearly_empty_size) + return 27; + if (sizeof (C8) == nearly_empty_size) + return 28; +#endif + return 0; + +}
empty2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: empty3.C =================================================================== --- empty3.C (nonexistent) +++ empty3.C (revision 816) @@ -0,0 +1,24 @@ +// { dg-do assemble } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 12 Apr 2001 + +// Check we deal with aligning virtual bases after a trailing empty +// base class properly + +struct A {}; +struct B1 : A {}; +struct B2 : A {}; +struct B3 : A {}; + +struct C : B1, B2, virtual B3 {}; + +int main () +{ +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 + C c; + if (((char *)static_cast (&c) - (char *)&c) % __alignof__ (C)) + return 1; +#endif + return 0; +}
empty3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: primary.C =================================================================== --- primary.C (nonexistent) +++ primary.C (revision 816) @@ -0,0 +1,73 @@ +// { dg-do run } +// Test to see that primary bases are selected correctly. +// Origin: Mark Mitchell + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 + +// S1 is a nearly-empty base. + +struct S1 +{ + virtual void f () + { + } +}; + +// S2 is a dynamic, but not nearly-empty, base. + +struct S2 +{ + virtual void g () + { + } + + int i; +}; + +// S1 should be the primary base. + +struct T1 : public S1, public S2 +{ +}; + +// S2 should be the primary base. + +struct T2 : public S2, public S1 +{ +}; + +// S2 should be the primary base. + +struct T3 : virtual public S1, public S2 +{ +}; + +// S1 should be the primary base. + +struct T4 : virtual public S1, virtual public S2 +{ +}; + +// Check that Y is the primary base for X. Otherwise, return N. +#define CHECK_PRIMARY_BASE(X, Y, N) \ + { \ + X x; \ + if ((void*) &x != (void *) (Y*) (&x)) \ + return N; \ + } + +int main () +{ + CHECK_PRIMARY_BASE (T1, S1, 1); + CHECK_PRIMARY_BASE (T2, S2, 2); + CHECK_PRIMARY_BASE (T3, S2, 3); + CHECK_PRIMARY_BASE (T4, S1, 4); +} + +#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ + +int main () +{ +} + +#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
primary.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: align.C =================================================================== --- align.C (nonexistent) +++ align.C (revision 816) @@ -0,0 +1,125 @@ +// { dg-do run { target i?86-*-linux* x86_64-*-linux* i?86-*-freebsd* i?86-*-darwin* } } +// { dg-require-effective-target ilp32 } +// { dg-options "-malign-double" } +// Origin: Alex Samuel + +/* Test the size and alignment of fundamental C types for compliance + with the IA-64 ABI. */ + +template +inline unsigned +alignmentof () +{ + struct S + { + char start_; + T object_; + }; + + return (unsigned) & ((S *) 0)->object_; +} + +/* Computes the alignment, in bytes, of TYPE. */ + +#define alignof(type) (alignmentof ()) + +enum A { a }; + +int +main () +{ + if (sizeof (char) != 1) + return 1; + if (alignof (char) != 1) + return 2; + if (sizeof (signed char) != 1) + return 3; + if (alignof (signed char) != 1) + return 4; + if (sizeof (unsigned char) != 1) + return 5; + if (alignof (unsigned char) != 1) + return 6; + if (sizeof (short) != 2) + return 7; + if (alignof (short) != 2) + return 8; + if (sizeof (signed short) != 2) + return 9; + if (alignof (signed short) != 2) + return 10; + if (sizeof (unsigned short) != 2) + return 11; + if (alignof (unsigned short) != 2) + return 12; + if (sizeof (int) != 4) + return 13; + if (alignof (int) != 4) + return 14; + if (sizeof (signed int) != 4) + return 15; + if (alignof (signed int) != 4) + return 16; + if (sizeof (unsigned int) != 4) + return 17; + if (alignof (unsigned int) != 4) + return 18; + if (sizeof (enum A) != 4) + return 19; + if (alignof (enum A) != 4) + return 20; +#ifdef HAVE_IA64_TYPES + if (sizeof (__int64) != 8) + return 21; + if (alignof (__int64) != 8) + return 22; + if (sizeof (signed __int64) != 8) + return 23; + if (alignof (signed ___int64) != 8) + return 24; + if (sizeof (unsigned __int64) != 8) + return 25; + if (alignof (unsigned __int64) != 8) + return 26; + if (sizeof (__int128) != 16) + return 27; + if (alignof (__int128) != 16) + return 28; + if (sizeof (signed __int128) != 16) + return 29; + if (alignof (signed ___int128) != 16) + return 30; + if (sizeof (unsigned __int128) != 16) + return 31; + if (alignof (unsigned ___int128) != 16) + return 32; +#endif /* HAVE_IA64_TYPES */ + if (sizeof (void *) != 4) + return 33; + if (alignof (void *) != 4) + return 34; + if (sizeof (void (*) ()) != 4) + return 35; + if (alignof (void (*) ()) != 4) + return 36; + if (sizeof (float) != 4) + return 37; + if (alignof (float) != 4) + return 38; + if (sizeof (double) != 8) + return 39; + if (alignof (double) != 8) + return 40; +#ifdef HAVE_IA64_TYPES + if (sizeof (__float80) != 16) + return 41; + if (alignof (__float80) != 16) + return 42; + if (sizeof (__float128) != 16) + return 43; + if (alignof (__float128) != 16) + return 44; +#endif /* HAVE_IA64_TYPES */ + + return 0; +}
align.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ptrmem.C =================================================================== --- ptrmem.C (nonexistent) +++ ptrmem.C (revision 816) @@ -0,0 +1,146 @@ +// { dg-do run } +// { dg-options "-fno-strict-aliasing" } +// Origin: Mark Mitchell + +/* Generally, the lowest bit of the ptr is used to indicate whether a + ptr-to-mem-func points to a virtual or a non-virtual member + function. However, some platforms use all bits to encode a + function pointer. Such platforms use the lowest bit of the delta, + that is shifted left by one bit. */ +#if defined __MN10300__ || defined __SH5__ || defined __arm__ || defined __thumb__ || defined __mips__ +#define ADJUST_PTRFN(func, virt) ((void (*)())(func)) +#define ADJUST_DELTA(delta, virt) (((delta) << 1) + !!(virt)) +#else +#define ADJUST_PTRFN(func, virt) ((void (*)())((ptrdiff_t)(func) + !!(virt))) +#define ADJUST_DELTA(delta, virt) (delta) +#endif + +/* IA64 uses function descriptors instead of function pointers in its + vtables, which means that we can't meaningfully compare them directly. */ +#if defined __ia64__ +#define CMP_PTRFN(A, B) (*(void **)(A) == *(void **)(B)) +#define VPTE_SIZE (16) +#else +#define CMP_PTRFN(A, B) ((A) == (B)) +#define VPTE_SIZE sizeof(void *) +#endif + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 + +// Check that pointers-to-member functions are represented correctly. + +#include + +struct S +{ + int i; + int j; +}; + +// Because S does not have a VPTR, it will not be a primary base of T, +// and will therefore end up at a nonzero offset. + +struct T : public S +{ + void f () {} + virtual void g () {} + virtual void h () {} +}; + +// Provide access to the raw function pointers. This is +// mangling-dependent. + +extern "C" void _ZN1T1fEv (); +extern "C" void _ZN1T1gEv (); +extern "C" void _ZN1T1hEv (); + +// This structure is a C representation of a pointer-to-member. + +struct ptrmemfunc +{ + void (*ptr) (); + ptrdiff_t adj; +}; + +typedef int S::*sdp; +typedef void (S::*sp)(); +typedef void (T::*tp)(); + +int +main () +{ + S s; + T t; + sp x; + tp y; + ptrmemfunc *xp = (ptrmemfunc *) &x; + ptrmemfunc *yp = (ptrmemfunc *) &y; + ptrdiff_t delta = ((char *) &t) - ((char*) (S*) (&t)); + + // Pointers-to-function-members should have the same size and + // alignment as the PTRMEMFUNC type. + if (sizeof (sp) != sizeof (ptrmemfunc)) + return 1; + if (__alignof__ (sp) != __alignof__ (ptrmemfunc)) + return 2; + + // The NULL pointer-to-member should have a NULL first PTR field. + x = 0; + if (xp->ptr != 0) + return 3; + y = x; + if (yp->ptr != 0) + return 4; + + // A non-virtual function should have a pointer to the function. + // There should be no adjustment for the `T' version, and an + // appropriate adjustment for the `S' version. + y = &T::f; + if (! CMP_PTRFN (yp->ptr, ADJUST_PTRFN (&_ZN1T1fEv, 0))) + return 5; + if (yp->adj != ADJUST_DELTA (0, 0)) + return 6; + x = (sp) y; + if (! CMP_PTRFN (xp->ptr, ADJUST_PTRFN (&_ZN1T1fEv, 0))) + return 7; + if (xp->adj != ADJUST_DELTA (delta, 0)) + return 8; + + // For a virtual function, we should see the vtable offset, plus + // one. `T::h' is in the second slot: the vtable pointer points to + // the first virtual function. + y = &T::h; + if (yp->ptr != ADJUST_PTRFN (VPTE_SIZE, 1)) + return 9; + if (yp->adj != ADJUST_DELTA (0, 1)) + return 10; + x = (sp) y; + if (xp->ptr != ADJUST_PTRFN (VPTE_SIZE, 1)) + return 11; + if (xp->adj != ADJUST_DELTA (delta, 1)) + return 12; + + // Pointers-to-data-members should have the same size and alignment + // as a ptrdiff_t. + if (sizeof (sdp) != sizeof (ptrdiff_t)) + return 13; + if (__alignof__ (sdp) != __alignof__ (ptrdiff_t)) + return 14; + + // The value of a pointer-to-data member should be the offset from + // the start of the structure. + sdp z = &S::j; + if ((char *) &s.j - (char *) &s != *((ptrdiff_t *) &z)) + return 15; + z = 0; + if (*((ptrdiff_t *) &z) != -1) + return 16; +} + +#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ + +int main () +{ +} + +#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
ptrmem.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: bitfields.C =================================================================== --- bitfields.C (nonexistent) +++ bitfields.C (revision 816) @@ -0,0 +1,160 @@ +// { dg-do run { target i?86-*-linux* x86_64-*-linux* i?86-*-freebsd* } } +// { dg-require-effective-target ilp32 } +// { dg-options "-malign-double" } +// Origin: Alex Samuel + +/* Test the layout of bitfields in C aggretagtes for compliance with + the IA-64 ABI. */ + +#include + +template +inline unsigned +alignmentof () +{ + struct S + { + char start_; + T object_; + }; + + return (unsigned) & ((S *) 0)->object_; +} + +/* Computes the alignment, in bytes, of TYPE. */ + +#define alignof(type) (alignmentof ()) + +/* Returns true iff all the bits in the range + START_BIT <= bit < START_BIT + NUM_BITS, and only those bits, are + set in the region of memory starting at BUF of LENGTH bytes. */ + +bool +check_bits (char *buf, + unsigned length, + unsigned start_bit, + unsigned num_bits) +{ + for (unsigned bit = 0; bit < 8 * length; ++bit) { + bool is_set = (buf[bit / 8] & (1 << (bit % 8))) != 0; + if (start_bit <= bit && bit < start_bit + num_bits) { + if (! is_set) + return false; + } + else { + if (is_set) + return false; + } + } + return true; +} + +/* Creates a variable of type AGGREGATE, sets FIELD to -1, and + verifies that NUM_BITS bits starting at START_BIT, and no other + bits, are set. If the check fails, returns with value RVAL. */ + +#define CHECK_FIELD(AGGREGATE, FIELD, START_BIT, NUM_BITS, RVAL) \ + do { \ + AGGREGATE a__; \ + std::memset (& a__, 0, sizeof (a__)); \ + a__.FIELD = -1; \ + if (! check_bits ((char *) & a__, sizeof (a__), START_BIT, NUM_BITS)) \ + return RVAL; \ + } while (0); + + + +/* Structs S1, S2, S3, S4, and union U5 are taken from Intel, "IA-64 + Software Conventions and Runtime Architecture Guide", version of + August 1999. */ + +struct S1 +{ + int j : 5; + int k : 6; + int m : 7; +}; + +#ifdef HAVE_IA64_TYPES +struct S2 +{ + short s : 9; + __int64 j : 9; + char c ; + short t : 9; + short u : 9; + char d ; +}; +#endif /* HAVE_IA64_TYPES */ + +struct S3 +{ + char c ; + short s : 8; +}; + +union U4 +{ + char c ; + short s : 8; +}; + +struct S5 +{ + char c ; + int : 0; + char d ; + short : 9; + char e ; + char : 0; +}; + + +int +main () +{ + if (sizeof (struct S1) != 4) + return 1; + if (alignof (struct S1) != 4) + return 2; + CHECK_FIELD (S1, j, 0, 5, 3); + CHECK_FIELD (S1, k, 5, 6, 4); + CHECK_FIELD (S1, m, 11, 7, 5); + +#ifdef HAVE_IA64_TYPES + if (sizeof (struct S2) != 16) + return 6; + if (alignof (struct S2) != 8) + return 7; + CHECK_FIELD (S2, s, 0, 9, 8); + CHECK_FIELD (S2, j, 9, 9, 9); + CHECK_FIELD (S2, c, 24, 8, 10); + CHECK_FIELD (S2, t, 32, 9, 11); + CHECK_FIELD (S2, u, 48, 9, 12); + CHECK_FIELD (S2, d, 64, 8, 13); +#endif /* HAVE_IA64_TYPES */ + + if (sizeof (struct S3) != 2) + return 14; + if (sizeof (struct S3) != 2) + return 15; + CHECK_FIELD (S3, c, 0, 8, 16); + CHECK_FIELD (S3, s, 8, 8, 17); + + if (sizeof (union U4) != 2) + return 18; + if (alignof (union U4) != 2) + return 19; + CHECK_FIELD (U4, c, 0, 8, 20); + CHECK_FIELD (U4, s, 0, 8, 21); + + if (sizeof (struct S5) != 9) + return 22; + if (alignof (struct S5) != 1) + return 23; + CHECK_FIELD (S5, c, 0, 8, 24); + CHECK_FIELD (S5, d, 32, 8, 25); + CHECK_FIELD (S5, e, 64, 8, 26); + + return 0; +}
bitfields.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vtable3.h =================================================================== --- vtable3.h (nonexistent) +++ vtable3.h (revision 816) @@ -0,0 +1,179 @@ +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 February 2001 + +// Check constructor vtables work. This is included from numerous test +// files, which set the #defines necessary to specify the hierarchy. + +#include +#include + +int fail; +struct A; + +template +int Test (DERIVED *d, int expect) +{ + BASE *b = static_cast (d); + void *full_b = dynamic_cast (b); + void *full_d = dynamic_cast (d); + A *ap = static_cast (b); + + if (full_b != full_d) + { + fail++; + fprintf (stderr, "base %s and derived %s have different full objects\n", + typeid (BASE).name (), typeid (DERIVED).name ()); + return 1; + } + + DERIVED *dynamic_d = dynamic_cast (b); + + if (dynamic_d != d) + { + fail++; + fprintf (stderr, "dynamic_cast from %s to %s failed\n", + typeid (BASE).name (), typeid (DERIVED).name ()); + return 1; + } + + b->Baz (static_cast (ap)); + + int res = b->Foo (static_cast (d)); + + if (res != expect) + { + fail++; + fprintf (stderr, "%s::Foo returned %d, expected %d\n", + typeid (BASE).name (), res, expect); + return 1; + } + + return 0; +} + +template +int Test (T *self, void *expected, int result) +{ + if (self != expected) + { + fail++; + fprintf (stderr, "%s::Foo wrong this pointer\n", typeid (T).name ()); + } + return result; +} + +struct A { +#ifndef A_EMPTY + int a_m; +#endif + virtual int Foo (void *p) {return Test (this, p, 1);} + virtual int Baz (void *p) {return Test (this, p, 1);} + A (); + ~A (); +}; + +struct B1: virtual A { +#ifndef B1_EMPTY + int b1_m; +#endif + virtual int Foo (void *p) {return Test (this, p, 2);} + B1(); + ~B1(); +}; + +struct B2: virtual A { +#ifndef B2_EMPTY + int b2_m; +#endif + virtual int Foo (void *p) {return Test (this, p, 3);} + B2(); + ~B2(); +}; + +struct Empty {}; + +struct C : C_PARENTS { +#ifndef C_EMPTY + int c_m; +#endif + virtual int Foo (void *p) {return Test (this, p, 4);} + C(); + ~C(); +}; + +A::A () +{ + fprintf (stderr, "%s\n", __PRETTY_FUNCTION__); + Test (this, 1); +} +A::~A () +{ + fprintf (stderr, "%s\n", __PRETTY_FUNCTION__); + Test (this, 1); +} + +B1::B1() +{ + fprintf (stderr, "%s\n", __PRETTY_FUNCTION__); + Test (this, 2); + Test (this, 2); +} +B1::~B1() +{ + fprintf (stderr, "%s\n", __PRETTY_FUNCTION__); + Test (this, 2); + Test (this, 2); +} +B2::B2() +{ + fprintf (stderr, "%s\n", __PRETTY_FUNCTION__); + Test (this, 3); + Test (this, 3); +} +B2::~B2() +{ + fprintf (stderr, "%s\n", __PRETTY_FUNCTION__); + Test (this, 3); + Test (this, 3); +} +C::C() +{ + fprintf (stderr, "%s\n", __PRETTY_FUNCTION__); + Test (this, 4); + Test (this, 4); +} +C::~C() +{ + fprintf (stderr, "%s\n", __PRETTY_FUNCTION__); + Test (this, 4); + Test (this, 4); +} + +struct D : C {}; +struct D1 : virtual C {}; +struct D2 : virtual A, virtual C {}; + +int main() +{ + { + fprintf (stderr, "C\n"); + C c; + } + { + fprintf (stderr, "D\n"); + D d; + } + { + fprintf (stderr, "D1\n"); + D1 d1; + } + { + fprintf (stderr, "D2\n"); + D2 d2; + } + if (fail) + fprintf (stderr, "There are %d failings\n", fail); + else + fprintf (stderr, "Passed\n"); + return fail ? 1 : 0; +}
vtable3.h Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: aggregates.C =================================================================== --- aggregates.C (nonexistent) +++ aggregates.C (revision 816) @@ -0,0 +1,126 @@ +// { dg-do run { target i?86-*-linux* x86_64-*-linux* i?86-*-freebsd* } } +// { dg-require-effective-target ilp32 } +// { dg-options "-malign-double" } +// Origin: Alex Samuel + +/* Test the data layout of C aggregates by checking aggregate size and + alignment and field offsets for compliance with the IA-64 ABI. */ + +template +inline unsigned +alignmentof () +{ + struct S + { + char start_; + T object_; + }; + + return (unsigned) & ((S *) 0)->object_; +} + +/* Computes the alignment, in bytes, of TYPE. */ + +#define alignof(type) (alignmentof ()) + +/* Computes the offset of FIELD in AGGREGATE. */ + +#define offsetof(aggregate, field) \ + ((unsigned) (& ((aggregate*) 0)->field)) + + +/* Structs S1, S2, S3, S4, and union U5 are taken from Intel, "IA-64 + Software Conventions and Runtime Architecture Guide", version of + August 1999. */ + +struct S1 +{ + char c; +}; + +struct S2 +{ + char c; + char d; + short s; + int n; +}; + +struct S3 +{ + char c; + short s; +}; + +struct S4 +{ + char c; + double d; + short s; +}; + +union U5 +{ + char c; + short s; + int j; +}; + + + +int +main () +{ + if (sizeof (struct S1) != 1) + return 1; + if (alignof (struct S1) != 1) + return 2; + if (offsetof (struct S1, c) != 0) + return 3; + + if (sizeof (struct S2) != 8) + return 4; + if (alignof (struct S2) != 4) + return 5; + if (offsetof (struct S2, c) != 0) + return 6; + if (offsetof (struct S2, d) != 1) + return 7; + if (offsetof (struct S2, s) != 2) + return 8; + if (offsetof (struct S2, n) != 4) + return 9; + + if (sizeof (struct S3) != 4) + return 10; + if (alignof (struct S3) != 2) + return 11; + if (offsetof (struct S3, c) != 0) + return 12; + if (offsetof (struct S3, s) != 2) + return 13; + + if (sizeof (struct S4) != 24) + return 14; + if (alignof (struct S4) != 8) + return 15; + if (offsetof (struct S4, c) != 0) + return 16; + if (offsetof (struct S4, d) != 8) + return 17; + if (offsetof (struct S4, s) != 16) + return 18; + + if (sizeof (union U5) != 4) + return 19; + if (alignof (union U5) != 4) + return 20; + if (offsetof (union U5, c) != 0) + return 21; + if (offsetof (union U5, s) != 0) + return 22; + if (offsetof (union U5, j) != 0) + return 23; + + return 0; +}
aggregates.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: crash1.C =================================================================== --- crash1.C (nonexistent) +++ crash1.C (revision 816) @@ -0,0 +1,21 @@ +// { dg-do assemble } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 11 Apr 2001 + +// Bug 1944. We failed to calculate nearly emptiness properly, and +// lost primary too. + +struct A1 {}; +struct A2 {}; + +struct B1 : virtual A1 {}; +struct B2 : virtual A2 {}; + +struct C1 : virtual B2 {}; +struct C2 : virtual B2 {}; + +struct D1 : virtual C1, virtual C2 {}; +struct D2 : virtual C2, virtual B1 {}; + +struct E : virtual D1, virtual D2 {};
crash1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vbase1.C =================================================================== --- vbase1.C (nonexistent) +++ vbase1.C (revision 816) @@ -0,0 +1,115 @@ +// { dg-do run } +// Copyright (C) 2000 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 16 Jan 2001 + +// Bug 1611. Under the new ABI, the vtable can be clobbered during dtoring our +// primary vbase. We mustn't use the vtable after that to locate our vbases. + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 +#include +#include + +int *ctorVBase = 0; +int *dtorVBase = 0; +int *ctorVDerived = 0; +int *dtorVDerived = 0; +int *ctorB = 0; +int *dtorB = 0; + +struct VBase +{ + int member; + VBase () + { + if (ctorVBase) exit (1); + ctorVBase = &member; + } + virtual ~VBase () + { + if (dtorVBase) exit (2); + dtorVBase = &member; + if (dtorVBase != ctorVBase) exit (3); + } + void Offset () const + { + printf ("VBase\n"); + printf (" VBase::member %d\n", &this->VBase::member - (int *)this); + } +}; + +struct VDerived : virtual VBase +{ + int member; + + VDerived () + { + if (ctorVDerived) exit (4); + ctorVDerived = &member; + } + virtual ~VDerived () + { + if (dtorVDerived) exit (5); + dtorVDerived = &member; + if (dtorVDerived != ctorVDerived) exit (6); + } + void Offset () const + { + printf ("VDerived\n"); + printf (" VBase::member %d\n", &this->VBase::member - (int *)this); + printf (" VDerived::member %d\n", &this->VDerived::member - (int *)this); + } +}; +struct B : virtual VBase +{ + int member; + void Offset () const + { + printf ("B\n"); + printf (" VBase::member %d\n", &this->VBase::member - (int *)this); + printf (" B::member %d\n", &this->B::member - (int *)this); + } +}; +struct MostDerived : B, virtual VDerived +{ + int member; + void Offset () const + { + printf ("MostDerived\n"); + printf (" VBase::member %d\n", &this->VBase::member - (int *)this); + printf (" B::member %d\n", &this->B::member - (int *)this); + printf (" VDerived::member %d\n", &this->VDerived::member - (int *)this); + printf (" MostDerived::member %d\n", &this->MostDerived::member - (int *)this); + } +}; + + +int main () +{ + { + MostDerived dum; + + int *this_ = (int *)&dum; + + if (ctorVBase != &dum.VBase::member) + return 23; + if (ctorVDerived != &dum.VDerived::member) + return 24; + + printf (" VBase::member %d\n", &dum.VBase::member - this_); + printf (" B::member %d\n", &dum.B::member - this_); + printf (" VDerived::member %d\n", &dum.VDerived::member - this_); + printf (" MostDerived::member %d\n", &dum.MostDerived::member - this_); + dum.MostDerived::Offset (); + dum.B::Offset (); + dum.VDerived::Offset (); + dum.VBase::Offset (); + } + return 0; +} +#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ + +int main () +{ +} + +#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
vbase1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vbase2.C =================================================================== --- vbase2.C (nonexistent) +++ vbase2.C (revision 816) @@ -0,0 +1,28 @@ +// { dg-do run } +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 5 Jun 2001 + +// Bug 3006. Constructor vtables were wrong. + +struct A +{ + virtual ~A() {} +}; + +class B : public virtual A {}; +class C : public virtual B {}; +class D1 : public virtual C {}; +class D2 : public virtual C {}; +class E + : public virtual D1, + public virtual D2 +{ +}; + + +int +main(int argc, char* argv[]) +{ + new E; + return 0; +}
vbase2.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: ptrflags.C =================================================================== --- ptrflags.C (nonexistent) +++ ptrflags.C (revision 816) @@ -0,0 +1,67 @@ +// { dg-do run } +// Test rtti pointer flags +// Copyright (C) 2000, 2002 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 15 Apr 2000 + +#include + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 +#include + +struct A {int m;}; +struct B; + +using namespace abi; + +int expect (int flags, std::type_info const &info) +{ + abi::__pbase_type_info const *ptr = + dynamic_cast (&info); + if (!ptr) + return 0; + if (ptr->__flags != flags) + return 0; + return 1; +} + +int main () +{ + if (! expect (0, typeid (A *))) + return 1; + if (! expect (1, typeid (A const *))) + return 2; + if (! expect (2, typeid (A volatile *))) + return 3; + if (! expect (4, typeid (A *__restrict__ *))) + return 4; + if (! expect (0, typeid (int A::*))) + return 5; + if (! expect (0, typeid (int A::**))) + return 6; + + if (! expect (8 | 0, typeid (B *))) + return 11; + if (! expect (8 | 1, typeid (B const *))) + return 12; + if (! expect (8 | 2, typeid (B volatile *))) + return 13; + if (! expect (8 | 4, typeid (B *__restrict__ *))) + return 14; + if (! expect (16 | 0, typeid (int B::*))) + return 15; + if (! expect (8 | 0, typeid (int B::**))) + return 16; + if (! expect (8 | 0, typeid (B A::*))) + return 17; + if (! expect (24, typeid (B B::*))) + return 18; + + return 0; +} + +#else +int main () +{ + return 0; +} +#endif
ptrflags.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vbase3.C =================================================================== --- vbase3.C (nonexistent) +++ vbase3.C (revision 816) @@ -0,0 +1,27 @@ +// { dg-do run } +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 5 Jun 2001 + +// Bug 3061. Constructor vtables were wrong. + +class A_base { + public: + virtual void foo() { } +}; +class A_skel : virtual public A_base { }; + +class B_base : virtual public A_base { }; +class B_skel : virtual public B_base, virtual public A_skel { }; + +class C_base : virtual public B_base { }; +class C_skel : virtual public C_base, virtual public B_skel { }; + +class D_base : virtual public C_base { }; +class D_skel : virtual public D_base, virtual public C_skel { }; + +class D_impl : virtual public D_skel { }; + +int main() +{ + D_impl i; +}
vbase3.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vbase4.C =================================================================== --- vbase4.C (nonexistent) +++ vbase4.C (revision 816) @@ -0,0 +1,166 @@ +// { dg-do run } +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 9 Jun 2001 + +// Bug 3089. We ICE'd in construction vtables. + +int failed; + +void fail (int val) +{ + if (!failed) + failed = val; +} + +struct A +{ + virtual ~A(); + A (); + virtual void check (void *whole, void *base); +}; + +A::A () +{ + check (this, this); +} +A::~A () +{ + check (this, this); +} + +void A::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (1); + else if (this != base) + fail (2); +} + +struct B +{ + virtual ~B (); + B (); + virtual void check (void *whole, void *base); +}; + +B::B () +{ + check (this, this); +} +B::~B () +{ + check (this, this); +} +void B::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (3); + else if (this != base) + fail (4); +} + +struct C : virtual public B, virtual public A +{ + virtual ~C (); + C (); + virtual void check (void *whole, void *base); +}; +C::C () +{ + check (this, this); +} +C::~C () +{ + check (this, this); +} +void C::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (5); + else if (this != base) + fail (6); + A::check (whole, static_cast (this)); + B::check (whole, static_cast (this)); +} + +struct D : virtual public A +{ + virtual ~D (); + D (); + virtual void check (void *whole, void *base); +}; +D::D () +{ + check (this, this); +} +D::~D () +{ + check (this, this); +} +void D::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (5); + else if (this != base) + fail (6); + A::check (whole, static_cast (this)); +} + +struct E : virtual public C, virtual public D +{ + virtual ~E (); + E (); + virtual void check (void *whole, void *base); +}; +E::E () +{ + check (this, this); +} +E::~E () +{ + check (this, this); +} +void E::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (5); + else if (this != base) + fail (6); + C::check (whole, static_cast (this)); + D::check (whole, static_cast (this)); +} + +struct F : virtual public E +{ + virtual ~F (); + F (); + virtual void check (void *whole, void *base); +}; +F::F () +{ + check (this, this); +} +F::~F () +{ + check (this, this); +} +void F::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (5); + else if (this != base) + fail (6); + E::check (whole, static_cast (this)); +} + +int main () +{ + A a; + B b; + C c; + D d; + E e; + F f; + + return failed; +}
vbase4.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: mangle1.C =================================================================== --- mangle1.C (nonexistent) +++ mangle1.C (revision 816) @@ -0,0 +1,7 @@ +// { dg-do assemble } +// Origin: Mark Mitchell + +struct S {}; + +void f (void (S::*)()) {} +void f (void (S::*)() const) {}
mangle1.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vbase5.C =================================================================== --- vbase5.C (nonexistent) +++ vbase5.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 12 Jun 2001 + +// 3130. A virtual base can have canonical and non-canonical instances +// of its primary. The canonical one should be first in dfs order. + +struct A +{ + virtual ~A (); +}; + +struct B +{ + virtual ~B (); +}; + + +struct C : virtual public A, virtual public B {}; +class D : public virtual C {}; +class E : public virtual C, public virtual D {};
vbase5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vbase6.C =================================================================== --- vbase6.C (nonexistent) +++ vbase6.C (revision 816) @@ -0,0 +1,22 @@ +// { dg-do assemble } +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 12 Jun 2001 + +// 3131. + +struct A +{ + virtual ~A (); +}; + +struct B +{ + virtual ~B (); +}; + + +struct C : virtual public B {}; +struct D : virtual public A, virtual public C {}; +struct E : public virtual C {}; +struct F : public virtual D, public virtual E {};
vbase6.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vbase7.C =================================================================== --- vbase7.C (nonexistent) +++ vbase7.C (revision 816) @@ -0,0 +1,41 @@ +// { dg-do run } +// Build don't run +// +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 12 Jun 2001 + +// 3132. A virtual thunk was missing. + +struct A +{ + int x; + virtual ~A() {} +}; + +struct B +{ + virtual ~B() { } +}; + + +struct C +{ + virtual ~C () {} +}; + + +struct D : public virtual A {}; +struct E : virtual public B, virtual public D {}; +struct F : virtual public C, virtual public E {}; +struct G : public virtual E {}; + +struct H : public virtual F, public virtual G +{ + virtual ~H (); +}; +H::~H() {} + +int main () +{ + return 0; +}
vbase7.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: arraynew.C =================================================================== --- arraynew.C (nonexistent) +++ arraynew.C (revision 816) @@ -0,0 +1,152 @@ +// { dg-do run } +// Origin: Mark Mitchell + +#if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 + +#include +#include + +void* p; + +void* operator new[](size_t s) throw (std::bad_alloc) +{ + // Record the base of the last array allocated. + p = malloc (s); + return p; +} + +template +void check_no_cookie (int i) +{ + void* a = new T[7]; + if (p != a) + exit (i); +} + +template +void check_no_placement_cookie (int i) +{ + p = malloc (13 * sizeof (T)); + void* a = new (p) T[13]; + if (p != a) + exit (i); +} + +template +void check_cookie (int i) +{ + void* a = new T[11]; + size_t x; + + // Compute the cookie location manually. +#ifdef __ARM_EABI__ + x = 8; +#else + x = __alignof__ (T); + if (x < sizeof (size_t)) + x = sizeof (size_t); +#endif + if ((char *) a - x != (char *) p) + exit (i); + + // Check the cookie value. + size_t *sp = ((size_t *) a) - 1; + if (*sp != 11) + exit (i); + +#ifdef __ARM_EABI__ + sp = ((size_t *) a) - 2; + if (*sp != sizeof (T)) + exit (i); +#endif +} + +template +void check_placement_cookie (int i) +{ + p = malloc (sizeof (T) * 11 + 100); + void* a = new (p) T[11]; + size_t x; + + // Compute the cookie location manually. +#ifdef __ARM_EABI__ + x = 8; +#else + x = __alignof__ (T); + if (x < sizeof (size_t)) + x = sizeof (size_t); +#endif + if ((char *) a - x != (char *) p) + exit (i); + + // Check the cookie value. + size_t *sp = ((size_t *) a) - 1; + if (*sp != 11) + exit (i); + +#ifdef __ARM_EABI__ + sp = ((size_t *) a) - 2; + if (*sp != sizeof (T)) + exit (i); +#endif +} + +struct X {}; + +template +struct Y { int i; virtual void f () {}; }; + +// A class with a non-trivial destructor -- it needs a cookie. +struct Z { ~Z () {}; }; +// Likewise, but this class needs a bigger cookie so that the array +// elements are correctly aligned. +struct Z2 { ~Z2 () {}; long double d; }; + +struct W1 { void operator delete[] (void *, size_t) {}; }; +struct W2 { void operator delete[] (void *) {}; + void operator delete[] (void *, size_t) {}; }; +struct W3 { void operator delete[] (void *, size_t) {}; + void operator delete[] (void *) {}; }; +struct W4 : public W1 {}; + +struct V { void *operator new[] (size_t s, void *p) + { return p; } + ~V () {} + }; + +int main () +{ + // There should be no cookies for types with trivial destructors. + check_no_cookie (1); + check_no_cookie (2); + check_no_cookie > (3); + + // There should be no cookies for allocations using global placement + // new. + check_no_placement_cookie (4); + check_no_placement_cookie (5); + check_no_placement_cookie (6); + + // There should be a cookie when using a non-trivial destructor. + check_cookie (7); + check_cookie (8); + + // There should be a cookie when using the two-argument array delete + // operator. + check_cookie (9); + check_cookie (10); + // But not when the one-argument version is also available. + check_no_cookie (11); + check_no_cookie (12); + + // There should be a cookie when using a non-global placement new. + check_placement_cookie (13); +} + +#else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ + +int main () +{ +} + +#endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
arraynew.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property Index: vbase8-5.C =================================================================== --- vbase8-5.C (nonexistent) +++ vbase8-5.C (revision 816) @@ -0,0 +1,80 @@ +// { dg-do run } +// { dg-options "-w" } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 24 Jul 2001 + +// Origin stefan@space.twc.de +// Bug 3145 case 5. Horribly complicated class hierarchy + +class C0 +{}; +class C1 + : virtual public C0 +{}; +class C2 + : public C0 + , virtual public C1 +{}; +class C3 + : virtual public C0 + , virtual public C2 + , public C1 +{}; +class C4 + : virtual public C0 + , virtual public C2 + , virtual public C1 + , virtual public C3 +{}; +class C5 + : virtual public C3 + , virtual public C2 + , virtual public C0 + , public C4 + , virtual public C1 +{}; +class C6 + : public C0 + , virtual public C3 + , public C4 + , virtual public C5 + , public C1 +{}; +class C7 + : virtual public C3 + , public C5 + , public C2 + , virtual public C4 + , public C6 + , public C0 +{}; +class C8 + : virtual public C2 + , public C5 + , public C7 + , public C1 + , public C0 + , public C4 + , public C3 +{}; +class C9 + : public C3 + , public C2 + , virtual public C6 + , public C8 + , virtual public C7 + , public C5 +{}; +main() { + C0 c0; + C1 c1; + C2 c2; + C3 c3; + C4 c4; + C5 c5; + C6 c6; + C7 c7; + C8 c8; + C9 c9; +}
vbase8-5.C Property changes : Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +Id \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.