LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "yuan cooper" <yuanxjtu@hotmail.com>
Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org,
dmitry.torokhov@gmail.com
Subject: Re: About GCC4 Optimization
Date: Sat, 24 Mar 2007 20:31:18 -0800 [thread overview]
Message-ID: <20070324203118.3ab22ea4.akpm@linux-foundation.org> (raw)
In-Reply-To: <BAY144-F24481F006CCA5D5D74D6F4DF680@phx.gbl>
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.
next prev parent reply other threads:[~2007-03-25 4:31 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-25 3:32 keyboard.c: Stop flooding dmesg with useless warnings Parag Warudkar
2007-03-25 3:38 ` Parag Warudkar
[not found] ` <BAY144-F24481F006CCA5D5D74D6F4DF680@phx.gbl>
2007-03-25 4:28 ` About GCC4 Optimization Linus Torvalds
2007-03-25 5:07 ` David Schwartz
2007-03-25 4:31 ` Andrew Morton [this message]
2007-03-25 5:15 ` keyboard.c: Stop flooding dmesg with useless warnings Dmitry Torokhov
2007-03-25 5:27 ` Parag Warudkar
2007-03-25 5:29 ` Dmitry Torokhov
2007-03-25 5:35 ` Parag Warudkar
2007-03-25 9:16 ` Jiri Kosina
2007-03-25 14:32 ` Parag Warudkar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070324203118.3ab22ea4.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=yuanxjtu@hotmail.com \
--subject='Re: About GCC4 Optimization' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).