Re: [RFC/RFA] gdb extension for Harvard architectures

Andrew Cagney
2001-10-10T00:56:00Z

>> To the best of my knowledge, ISO C says nothing about cast operations
>> that convert between code and data pointers. What we do have is a
>> certain level of accepted behavour. For instance on a unified byte
>> addressable address space architecture things like:
>>
>> sizeof(void*) == sizeof((*)())
>> ((*)()) (void*) foo == ((*)()) foo
>>
>> However, on a harvard address space architecture we have none of that.
>
>
> Right. We don't. What's your point?

Compilers, such as GCC implement:

int *i = &func;

based on the assumption that sizeof(i) == sizeof(&func) - that is the
operation is a simple copy.

I think it is reasonable to expect that one day there will be targets
that have sizeof(i) < sizeof(&func) (or vice versa) which would then
make the above totally meaningless - the value would be truncated during
the transfer.

Andrew