lkml.org 
[lkml]   [2007]   [Mar]   [25]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSat, 24 Mar 2007 20:31:18 -0800
FromAndrew Morton <>
SubjectRe: About GCC4 Optimization
On Sun, 25 Mar 2007 03:42:25 +0000 "yuan cooper" <yuanxjtu@hotmail.com> 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) && 0xFFF;
> --------------------- 
> 
> if optimization level is O2, gcc will MOV eax to tmp, but current eax has a random value.
> -O is ok and gcc3 with O2 is ok too.
> 
> 
> I am a kernel newbie, I don't know how to make contributions to janitors, who will help me? It's my first post, any suggestion will be appreciated.

Don't use floating point in kernel code.  At all.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-03-25 06:33    [from the cache]
©2003-2008