RE: About GCC4 Optimization

2007-03-24 Thread David Schwartz
> So what gcc does may be technically legal, but it's still a horribly > bad thing to do. Sadly, some gcc people seem to care more > about "letter > of the law" than "sanity and quality of implementation". You know, it would be one thing if they were consistent. A policy that, by default, you get

Re: About GCC4 Optimization

2007-03-24 Thread Andrew Morton
On Sun, 25 Mar 2007 03:42:25 + "yuan cooper" <[EMAIL PROTECTED]> wrote: > Hi all: > > during my work, I found there is a bug with GCC4 O2 optimization. > > - > float ftmp; > unsigned long tmp; > ftmp = 1.0/1024.0; > tmp = *(unsigned long *)(&ftmp); > tmp = (tmp >> 11)

Re: About GCC4 Optimization

2007-03-24 Thread Linus Torvalds
On Sun, 25 Mar 2007, yuan cooper wrote: > � > during my work, I found�there is a bug with GCC4 O2 optimization. Technically, it's a misfeature fo gcc4, not a bug. The C language allows for type-based alias detection, and gcc notices that a "float *" cannot ever alias with a "unsigned long *",