This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/8829: Over-optimization at -O2 and above (affecting GLIBC macros)
- From: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 5 Dec 2002 22:46:02 -0000
- Subject: Re: optimization/8829: Over-optimization at -O2 and above (affecting GLIBC macros)
- Reply-to: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>
The following reply was made to PR optimization/8829; it has been noted by GNATS.
From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
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