This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: optimization/8829: Over-optimization at -O2 and above (affecting GLIBC macros)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]