From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31633 invoked by alias); 19 Jun 2007 10:53:03 -0000 Received: (qmail 31578 invoked by alias); 19 Jun 2007 10:52:52 -0000 Date: Tue, 19 Jun 2007 10:53:00 -0000 Message-ID: <20070619105252.31577.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/32397] wrong instruction order generated In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rosenfeld at grumpf dot hope-2000 dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-06/txt/msg01564.txt.bz2 ------- Comment #2 from rosenfeld at grumpf dot hope-2000 dot org 2007-06-19 10:52 ------- Subject: Re: wrong instruction order generated On Tue, Jun 19, 2007 at 07:56:01AM -0000, pinskia at gcc dot gnu dot org wrote: > ------- Comment #1 from pinskia at gcc dot gnu dot org 2007-06-19 07:56 ------- > ((Cyg_libm_ieee_double_shape_type *)&x)->part is ovbiously an aliasing > violation. I doubt that. As you can see in the source file, x is a double and Cyg_libm_ieee_double_shape_type is a union containing a double. To quote the standard, 7 An object shall have its stored value accessed only by an lvalue expression that has one of the following types: a type compatible with the effective type of the object, [...] an aggregate or union type that includes one of the aforementioned types among its members (including, recursively, a member of a subaggregate or contained union) [...] So as far as I understand this should be perfectly legal by the ISO C standard. Maybe I'm missing somthing here, I read everywhere that using a union for this kind of thing is a gcc extension. I wonder, if there is no standard way to manipulate doubles by treating them as ints or bitfields or something like that, how is one supposed to write a floating point emulator in ISO C? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32397