1 // Origin: Mark Mitchell <mark@codesourcery.com>
2 // Special g++ Options: -fno-strict-aliasing
4 #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
13 struct S1 : virtual public S0
18 struct S2 : virtual public S1
29 struct S4 : public S3, virtual public S2
58 /* The vtables should look like:
110 S2-in-S4 secondary vtable
123 // These are tricks to allow us to get raw function pointers for
136 // Set vtbl to point at the beginning of S4's primary vtable.
137 vptr = (ptrdiff_t **) &s4;
141 if (*vtbl++ != ((char*) (S0*) &s4) - (char*) &s4)
143 if (*vtbl++ != ((char*) (S1*) &s4) - (char*) &s4)
145 if (*vtbl++ != ((char*) (S2*) &s4) - (char*) &s4)
149 // Skip the RTTI entry.
151 if (*vtbl++ != (ptrdiff_t) &_ZN2S32s3Ev)
153 if (*vtbl++ != (ptrdiff_t) &_ZN2S42s1Ev)
155 // The S1 vbase offset.
158 // The S4::s1 vcall offset is negative; once you convert to S2, you
159 // have to convert to S4 to find the final overrider.
160 if (*vtbl++ != ((char*) &s4 - (char*) (S2*) &s4))
166 // Now we're at the S2 offset to top entry.
167 if (*vtbl++ != ((char*) &s4 - (char*) (S2*) &s4))
169 // Skip the RTTI entry.
171 // Skip the remaining virtual functions -- they are thunks.
176 #else /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */
182 #endif /* !(defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100) */