This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: about named address space
- From: Ian Lance Taylor <iant at google dot com>
- To: Rony Paul <ronypaul77 at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 06 Jun 2011 10:28:44 -0700
- Subject: Re: about named address space
- References: <BANLkTi=mDVA-UNsHG6a2UBDT7Sdrz5RzqA@mail.gmail.com> <BANLkTik-Y0=YL3pOUQJ_JJ-dKtezJuQVVQ@mail.gmail.com> <mcrsjs8379w.fsf@coign.corp.google.com> <BANLkTikE2p1R-ac=e+Vy=cE+4ETsho9WoQ@mail.gmail.com> <mcrr57ojhzb.fsf@coign.corp.google.com> <BANLkTi=Obcz+8=sy8XmOLWi1_9-1pJSugQ@mail.gmail.com> <mcr7h9c2o4p.fsf@coign.corp.google.com> <BANLkTim7Ne_+Kq863GnJfMG6CUvy8amqYw@mail.gmail.com> <BANLkTinwY5-S9-2SRKGVE+T_VPh2uvo3Ew@mail.gmail.com>
Rony Paul <ronypaul77@gmail.com> writes:
> and in my program if I write code like,
> __ea int * p = malloc_ea(sizeof(int));
> int * v;
> p=v;
>
> this returns error message "assignment from pointer to non-enclosed
> address space"
> so, this checking for pointer of the different address space is done
> for pointer. now if I want to add this check for data variable also,
> what should I do. I cant understand, would you please help me?
>
> ie. I want to write code like
>
> extern int __ea x;
> int y;
>
> and it should give error message like
> "assignment from variable to non-enclosed address space"
I'm not aware of any support in current gcc for anything like that. In
effect you are asking not for named address spaces, but for a brand new
type. You want to permit pointers to your new type, but you don't want
to permit assignments between values of your new type and the old types.
I suspect that the most straightforward way to handle this would be to
do it entirely in the frontend, which is where types are handled. I
suppose you could tie it into named address spaces to the extent that
you want values of your new type to be aggregated into specific areas in
memory.
In short I don't know of any easy way to do what you want.
Ian