From owner-freebsd-current Mon Nov 11 23:25:21 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ED3AD37B401 for ; Mon, 11 Nov 2002 23:25:19 -0800 (PST) Received: from mailhub.fokus.gmd.de (mailhub.fokus.gmd.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9A14943E42 for ; Mon, 11 Nov 2002 23:25:18 -0800 (PST) (envelope-from brandt@fokus.gmd.de) Received: from beagle (beagle [193.175.132.100]) by mailhub.fokus.gmd.de (8.11.6/8.11.6) with ESMTP id gAC7PCl17377; Tue, 12 Nov 2002 08:25:12 +0100 (MET) Date: Tue, 12 Nov 2002 08:25:12 +0100 (CET) From: Harti Brandt To: David Malone Cc: Andrew Gallatin , Subject: Re: gcc 3.2.1 optimization bug ? In-Reply-To: <20021111223924.GA30568@walton.maths.tcd.ie> Message-ID: <20021112082236.Y34632-100000@beagle.fokus.gmd.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 11 Nov 2002, David Malone wrote: DM>On Mon, Nov 11, 2002 at 04:52:22PM +0100, Harti Brandt wrote: DM>AG>But does using a union make it safe? DM> DM>> Well, I just had a long discussion with a collegue about the topic. The DM>> main problem is in the ISO-C standard, section 6.7 point 4 which states: DM>> DM>> All declarations in the same scope that refer to the same object or DM>> function shall specify compatible types. DM> DM>I think Section 6.5 paragraph 7 allows access through unions. There DM>is a footnote saying that the list given (which includes access DM>through the same type, qualified versions of the same type, aggregates DM>and unions containign that type and character types) is intended DM>for determining aliasing rules. That just allows you to do int foo union bar { int foofoo; } *ptr = (union bar)&foo; I think. You end up with the same situation - you can refer the integer object foo only through an integer pointer. harti -- harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.gmd.de, brandt@fokus.fhg.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message