From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1451 invoked by alias); 20 Feb 2003 14:36:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 1435 invoked by uid 71); 20 Feb 2003 14:36:01 -0000 Date: Thu, 20 Feb 2003 14:36:00 -0000 Message-ID: <20030220143601.1434.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Andreas Schwab Subject: Re: c/9762: Address of 'char' is incorrect. Reply-To: Andreas Schwab X-SW-Source: 2003-02/txt/msg00991.txt.bz2 List-Id: The following reply was made to PR c/9762; it has been noted by GNATS. From: Andreas Schwab To: stephen.kennedy@havok.com Cc: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org Subject: Re: c/9762: Address of 'char' is incorrect. Date: Thu, 20 Feb 2003 15:26:33 +0100 stephen.kennedy@havok.com writes: |> #define TA char |> #define TB int |> #define TC int |> |> void foobar(TA a, TB b, TC c); |> |> int main() |> { |> foobar(1,2,3); |> return 0; |> } |> |> void foobar(TA a, TB b, TC c) |> { |> printf("a == %i claims %x\n", a, &a); |> printf("a == %i really %x\n", (&b)[-1], (&b)-1); There is nothing in the C standard that requires that (char*)(&b-1) == &a. They are distinct objects, thus not comparable, and &b-1 by itself is already invalid. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."