From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11710 invoked by alias); 4 Apr 2003 03:06: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 11696 invoked by uid 71); 4 Apr 2003 03:06:01 -0000 Date: Fri, 04 Apr 2003 03:06:00 -0000 Message-ID: <20030404030601.11695.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Nigel Stewart Subject: Re: c++/1833 Reply-To: Nigel Stewart X-SW-Source: 2003-04/txt/msg00128.txt.bz2 List-Id: The following reply was made to PR c++/1833; it has been noted by GNATS. From: Nigel Stewart To: Wolfgang Bangerth Cc: gcc-gnats@gcc.gnu.org Subject: Re: c++/1833 Date: Fri, 04 Apr 2003 12:58:54 +1000 Wolfgang, Heeding your advice about aliasing rules, I've replaced the cast with a union. Problem is solved. However, I would suggest that gcc should provide warnings or errors in the case of being fed illegal code. float foo() { assert(sizeof(unsigned int)==sizeof(float)); union { float f; unsigned int i; } tmp; tmp.i = (127<<23) | (1<<22); return tmp.f; } Thanks for your response, and my apologies for cluttering the bug database... N Stewart > Nigel, > the problem you sent has nothing to do with the problem described in PR > 1833. You are violating aliasing rules. The code in the report is legal, > yours is not. > > W.