From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24994 invoked by alias); 28 Mar 2003 22:16:00 -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 24974 invoked by uid 71); 28 Mar 2003 22:16:00 -0000 Date: Fri, 28 Mar 2003 22:26:00 -0000 Message-ID: <20030328221600.24971.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Falk Hueffner Subject: Re: optimization/10258: byteswapping code fails in -O2 Reply-To: Falk Hueffner X-SW-Source: 2003-03/txt/msg02019.txt.bz2 List-Id: The following reply was made to PR optimization/10258; it has been noted by GNATS. From: Falk Hueffner To: warren_baird@cimmetry.com Cc: gcc-gnats@gcc.gnu.org Subject: Re: optimization/10258: byteswapping code fails in -O2 Date: 28 Mar 2003 23:15:44 +0100 warren_baird@cimmetry.com writes: > FLOAT swapFLOAT(FLOAT f) > { > FLOAT ret; > DWORD* pDW = (DWORD*)&ret; > *pDW = BYTESWAP_DWORD(*(DWORD*)&f); You're violating aliasing constraints here > printf("0x%08X 0x%08X\n", *(long *)&f1, *(long *)&sf1); and here. So this is not a gcc bug. Please read the documentation of -fstrict-aliasing. -- Falk