This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: making sizeof(void*) different from sizeof(void(*)())


On Mon, Apr 30, 2012 at 4:50 AM, Robert Dewar <dewar@adacore.com> wrote:
> On 4/30/2012 4:16 AM, Paulo J. Matos wrote:
>>
>> Peter,
>>
>> We have a working backend for an Harvard Architecture chip where
>> function pointer and data pointers have necessarily different sizes. We
>> couldn't do this without changing GCC itself in strategic places and
>> adding some extra support in our backend. We haven't used address spaces
>> or any other existing GCC solution.

I would like to see the technical details, if your code is released somewhere.

Without having started it yet, I'm thinking this can be done by
modifying build_pointer_type to generalize the
TARGET_ADDR_SPACE_POINTER_MODE to TARGET_TYPE_POINTER_MODE, pass it
the whole type instead of just the address space field, and moving
TARGET_ADDR_SPACE_POINTER_MODE support to the default implementation
for that hook. Likewise for build_reference_type.  Then judicious
application of attributes to types and decls would allow detection of
the situation where a non-standard pointer size is needed.  I'm hoping
there aren't too many other places where that work would get undone.

>
> Sounds like a useful set of changes to have in the main sources, since
> this is hardly a singular need!

Yes.  Is there an existing bug/enhancement report for this capability?

Peter


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]