Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Nov 2002 08:25:12 +0100 (CET)
From:      Harti Brandt <brandt@fokus.gmd.de>
To:        David Malone <dwmalone@maths.tcd.ie>
Cc:        Andrew Gallatin <gallatin@cs.duke.edu>, <FreeBSD-current@FreeBSD.ORG>
Subject:   Re: gcc 3.2.1 optimization bug ?
Message-ID:  <20021112082236.Y34632-100000@beagle.fokus.gmd.de>
In-Reply-To: <20021111223924.GA30568@walton.maths.tcd.ie>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021112082236.Y34632-100000>