From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29439 invoked by alias); 5 Dec 2002 22:46:03 -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 29401 invoked by uid 71); 5 Dec 2002 22:46:02 -0000 Date: Thu, 05 Dec 2002 14:46:00 -0000 Message-ID: <20021205224602.29400.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Falk Hueffner Subject: Re: optimization/8829: Over-optimization at -O2 and above (affecting GLIBC macros) Reply-To: Falk Hueffner X-SW-Source: 2002-12/txt/msg00323.txt.bz2 List-Id: The following reply was made to PR optimization/8829; it has been noted by GNATS. From: Falk Hueffner To: bagnara@cs.unipr.it Cc: gcc-gnats@gcc.gnu.org, abramo.bagnara@libero.it Subject: Re: optimization/8829: Over-optimization at -O2 and above (affecting GLIBC macros) Date: 05 Dec 2002 23:41:02 +0100 bagnara@cs.unipr.it writes: > With -O2, gcc removes instructions that should not be removed. > >How-To-Repeat: > Compile the attached file, bug.cc, with > $ gcc -S -O2 bug.c > and notice that the instructions for swapping the bytes > have been removed from get_float32() while, interestingly, > they have not been removed from get_int32(). > Notice also that, if the call to q(v) is uncommented from > get_float32(), the over-optimization goes away. [...] > static inline void swap_float32(float* p) > { > *(int*)p = __bswap_32(*(int*)p); > } Looks to me like this violates aliasing rules, and indeed -fno-strict-aliasing keeps the asm. -- Falk