[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20070324203118.3ab22ea4.akpm@linux-foundation.org>
Date: Sat, 24 Mar 2007 20:31:18 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: "yuan cooper" <yuanxjtu@...mail.com>
Cc: linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
dmitry.torokhov@...il.com
Subject: Re: About GCC4 Optimization
On Sun, 25 Mar 2007 03:42:25 +0000 "yuan cooper" <yuanxjtu@...mail.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists