diff options
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C | 18 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.abi/vtable2.C | 19 |
3 files changed, 34 insertions, 8 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 74508a6c941..ac98003e9cb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2001-09-21 Richard Henderson <rth@redhat.com> + + * g++.old-deja/g++.abi/ptrmem.C: Update for ia64 c++ abi. + * g++.old-deja/g++.abi/vtable2.C: Likewise. + 2001-09-21 Joseph S. Myers <jsm28@cam.ac.uk> Table-driven attributes. diff --git a/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C b/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C index 6bef481d8cf..38f8177a2a6 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C @@ -14,6 +14,16 @@ #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. @@ -85,12 +95,12 @@ main () // There should be no adjustment for the `T' version, and an // appropriate adjustment for the `S' version. y = &T::f; - if (yp->ptr != ADJUST_PTRFN (&_ZN1T1fEv, 0)) + if (! CMP_PTRFN (yp->ptr, ADJUST_PTRFN (&_ZN1T1fEv, 0))) return 5; if (yp->adj != ADJUST_DELTA (0, 0)) return 6; x = (sp) y; - if (xp->ptr != ADJUST_PTRFN (&_ZN1T1fEv, 0)) + if (! CMP_PTRFN (xp->ptr, ADJUST_PTRFN (&_ZN1T1fEv, 0))) return 7; if (xp->adj != ADJUST_DELTA (delta, 0)) return 8; @@ -99,12 +109,12 @@ main () // 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 (sizeof (void *), 1)) + 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 (sizeof (void *), 1)) + if (xp->ptr != ADJUST_PTRFN (VPTE_SIZE, 1)) return 11; if (xp->adj != ADJUST_DELTA (delta, 1)) return 12; diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C b/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C index 5fe1e140d6c..9847a15a8b8 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/vtable2.C @@ -127,6 +127,15 @@ void _ZN2S32s3Ev (); void _ZN2S42s1Ev (); } +// IA-64 uses function descriptors not function pointers in its vtables. +#if defined __ia64__ +#define CMP_VPTR(A, B) (*(void **)(A) == *(void **)(B)) +#define INC_VPTR(A) ((A) += 2) +#else +#define CMP_VPTR(A, B) (*(A) == (ptrdiff_t)(B)) +#define INC_VPTR(A) ((A) += 1) +#endif + int main () { S4 s4; @@ -148,10 +157,12 @@ int main () return 4; // Skip the RTTI entry. vtbl++; - if (*vtbl++ != (ptrdiff_t) &_ZN2S32s3Ev) + if (! CMP_VPTR (vtbl, &_ZN2S32s3Ev)) return 5; - if (*vtbl++ != (ptrdiff_t) &_ZN2S42s1Ev) + INC_VPTR (vtbl); + if (! CMP_VPTR (vtbl, &_ZN2S42s1Ev)) return 6; + INC_VPTR (vtbl); // The S1 vbase offset. if (*vtbl++ != 0) return 7; @@ -169,8 +180,8 @@ int main () // Skip the RTTI entry. vtbl++; // Skip the remaining virtual functions -- they are thunks. - vtbl++; - vtbl++; + INC_VPTR (vtbl); + INC_VPTR (vtbl); } #else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */ |