On Feb 11, 2012, at 05:37, Eric Botcazou wrote: > The polymorphism pointer/address indeed proves to be problematic in certain > circumstances (e.g. it breaks on m68k, see PR ada/48835). My understanding > is > that using pointers in Ada is heavyweight, hence the choice of an integer for > System.Address; and I'm reluctant to enter the type morphing business in gigi.
There are two issues: - In the Ada front end and run time, we rely on Address being an unsigned type, so we can do address arithmetic. Ada doesn't have the notion of pointer arithmetic. - Access types (pointers) in Ada carry not only carry the address, but also the bounds in case of unconstrained types (as you well know) I agree it doesn't fit well to do that, and seems pointless as one cannot dereference Address anyway, so we have conversions where needed. > But we could investigate changing System.Memory to use an access type instead > of System.Address. It's a compiler unit so the impact should be limited, and > at least this would solve the m68k problem. Probably for Convention C, we should convert Address to *void. So, for function Alloc (Size : size_t) return System.Address; pragma Export (C, Alloc, "__gnat_malloc"); we probably should do this replacement and add the necessary type conversions. That would seem to be how this was intended. However, I'm not sure how much of an earthquake this would be in gigi. -Geert