C++ ptrmemfun break if FUNCTION_BOUNDARY < 2 * BITS_PER_UNIT
Dave Korn
davek-ml@ntlworld.com
Sat Apr 7 10:12:00 GMT 2001
> > Alexandre Oliva wrote:-
> >
> > > 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.
From: "Richard Earnshaw" <rearnsha@arm.com>
> Nope.
> Nope.
> All 32 bits in an ARM pointer have meaning in some context or another.
> There are no spare ones for this sort of diddling.
>
> I think you need to find another way to represent this information.
Seconded. I was working on m68ks around the transition from the '000 to
'020. The address bus got 8 bits wider. Suddenly addresses and hence
pointers went from 24 significant bits to 32 significant bits, and all the
software that had been using the high byte of a pointer to store flag bits
broke hideously. This caused a lot of pain on Macs, where it was a common
technique, and much less on Amigas, where it had been warned against,
forbidden even, from the outset in the ABI / coding standards.
The lesson should be learned. Don't try and hide extra data in pointers:
their format belongs to the CPU and is not under your control.
DaveK
More information about the Gcc
mailing list