From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30258 invoked by alias); 6 Jun 2011 17:29:05 -0000 Received: (qmail 30249 invoked by uid 22791); 6 Jun 2011 17:29:04 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Jun 2011 17:28:50 +0000 Received: from hpaq1.eem.corp.google.com (hpaq1.eem.corp.google.com [172.25.149.1]) by smtp-out.google.com with ESMTP id p56HSngi019757 for ; Mon, 6 Jun 2011 10:28:49 -0700 Received: from pxi6 (pxi6.prod.google.com [10.243.27.6]) by hpaq1.eem.corp.google.com with ESMTP id p56HSdLa000497 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Mon, 6 Jun 2011 10:28:48 -0700 Received: by pxi6 with SMTP id 6so2666388pxi.17 for ; Mon, 06 Jun 2011 10:28:47 -0700 (PDT) Received: by 10.68.8.66 with SMTP id p2mr1993851pba.505.1307381327504; Mon, 06 Jun 2011 10:28:47 -0700 (PDT) Received: from coign.google.com ([216.239.45.130]) by mx.google.com with ESMTPS id c3sm3812238pbk.93.2011.06.06.10.28.46 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 06 Jun 2011 10:28:46 -0700 (PDT) From: Ian Lance Taylor To: Rony Paul Cc: gcc-help@gcc.gnu.org Subject: Re: about named address space References: Date: Mon, 06 Jun 2011 19:51:00 -0000 In-Reply-To: (Rony Paul's message of "Mon, 6 Jun 2011 17:16:20 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg00119.txt.bz2 Rony Paul 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