From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: Jim Blandy Cc: Michael Snyder , gdb-patches@sources.redhat.com Subject: Re: [RFC/RFA] gdb extension for Harvard architectures Date: Wed, 10 Oct 2001 00:56:00 -0000 Message-id: <3BC3FF25.2090207@cygnus.com> References: <3BB4D843.A92818B9@cygnus.com> <3BB512A9.6050801@cygnus.com> <3BB5195F.6050603@cygnus.com> <3BBA2DC9.5060500@cygnus.com> <3BBA3B03.B864ABE0@cygnus.com> <3BBA54AE.3080104@cygnus.com> <3BBB6549.2050803@cygnus.com> X-SW-Source: 2001-10/msg00108.html >> 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