C++ ptrmemfun break if FUNCTION_BOUNDARY < 2 * BITS_PER_UNIT
Alexandre Oliva
aoliva@redhat.com
Fri Apr 6 03:14:00 GMT 2001
The C++ ABI v3 uses the least significant bit of the pfn to tell
non-virtual from virtual functions. The problem is that, on
architectures that don't impose any alignment requirements on
beginning of functions, the assumption that pfn&1 == 0 for pointers to
non-virtual member functions doesn't always hold. This breaks C++ on
at least avr, elxsi, mn10200, mn10300 and pj.
I suppose we could just bump FUNCTION_BOUNDARY up, but I'd rather not
do it on targets in which code size is an important issue. That's the
case of mn10300.
It would be great if we could enforce 2-byte alignment only on
non-virtual member functions whose addresses were taken to construct
pointers to member functions, but, since we can't tell in advance
whether the address of a non-virtual member function was taken, we'd
have to assume at least all non-virtual member functions have to be
aligned to 2 * BITS_PER_UNIT.
Another possibility I see is to arrange for the bit used to tell
non-virtual from virtual member functions in pointers to members be
moved to the delta field of the pointer to member, in case
FUNCTION_BOUNDARY < 2 * BITS_PER_UNIT. This would be a diversion from
the IA64 C++ ABI, but it makes more sense to me, for targets in which
function addresses are not guaranteed to be even addresses.
Opinions?
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me
More information about the Gcc
mailing list