From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4160 invoked by alias); 22 Feb 2011 18:46:08 -0000 Received: (qmail 4144 invoked by uid 22791); 22 Feb 2011 18:46:07 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from wp154.webpack.hosteurope.de (HELO wp154.webpack.hosteurope.de) (80.237.132.161) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Feb 2011 18:46:01 +0000 Received: from roscs001.americas.hp.net ([15.251.201.70] helo=[80.237.132.161]); authenticated by wp154.webpack.hosteurope.de running ExIM with esmtpa id 1PrxFG-0007eq-Gu; Tue, 22 Feb 2011 19:45:58 +0100 Message-ID: <4D640445.1050809@andihellmund.com> Date: Tue, 22 Feb 2011 19:10:00 -0000 From: Andi Hellmund User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.11pre) Gecko/20100624 Spicebird/0.8 MIME-Version: 1.0 To: Ian Lance Taylor CC: zhang qingshan , gcc-help Subject: Re: why this testcase compile failed for gcc. References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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-02/txt/msg00364.txt.bz2 Hey > The C standard does not require that a function pointer use the same > representation as any other type of pointer. In particular, on > processors with Harvard architectures, function pointers and regular > pointers are inherently different. > @Ian: do you have a reference section where this is described. I shortly tried to search for a few keywords in the standard, but couldn't find the obvious. I would just be interested in the details ... @Steven: to give you a practical example: HP-UX on Itanium for example uses two different representations for data pointers and functions pointers: while data pointers are usual 64-bit addresses (purely assuming 64-bit compilation mode), function pointers however are pointers to a data structure called function description which contains two further pointers: (a) the final target address and (b) a so-called global data pointer for relative data addressing. Though if you would print out a function pointer on HP-UX, you would also get a single address, but it is NOT the address of the function to be called. This example is not as good as Ian's one, but is somehow similar, I think. Best regards, Andi