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

Andrew Cagney
2001-10-03T12:22:00Z

> - If an expression E has some type T, then &E has type T *.

To be pedantic:

An expression E has some type T, then &E has type T *@data.

It is defining a pointer from data space to either code or data space.

> This is a fundamental operation, and choosing the wrong behavior here
> will inevitably cause troubles elsewhere, too.
>
> Suppose you attach the qualifier to the pointer, and not the pointee.
> That is, `@code' may only be applied to pointer types, and it means
> that the pointer points to something in code space.

Sorry, you've lost me. What is being discussed is the cast operator and
its semantics. A cast takes a type and expression parameter and returns
an expression.

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.

Andrew