On Fri, 2007-08-03 at 10:34 -0700, Nathan Froyd wrote: 
> On Fri, Aug 03, 2007 at 06:24:06PM +0100, Paul Brook wrote:
> > On Friday 03 August 2007, Jonathan S. Shapiro wrote:
> > > Then it seems very curious that the constant folding should fail on this
> > > platform. Any idea what may be going on here?
> > 
> > You're exploiting a hole in the C aliasing rules by accessing a 32-bit int 
> > as 
> > type char. I tested several compilers (4.2, 4.1 and 3.4 x86, 4.2 m68k and 
> > 4.2 
> > arm) and the only one that eliminated the comparison was 3.4-x86.
> 
> FWIW, rewriting it with the "obvious" union approach seems to give the
> desired results on 4.2 arm with and without -mbig-endian.

Curiously, rewriting it with the "obvious" union approach didn't work at
all on gcc-3.4.6. We're going to move forward go gcc-4.x anyway, but
there are other priorities at the moment.

shap

Reply via email to