Messages in this thread | | | Date | Thu, 6 Aug 1998 15:00:52 +0200 | From | Andi Kleen <> | Subject | Re: floating-point abuse in 2.1.113 |
| |
On Thu, Aug 06, 1998 at 02:49:39PM +0200, Richard B. Johnson wrote: > On Thu, 6 Aug 1998, Andi Kleen wrote: > > > On Thu, Aug 06, 1998 at 03:36:48AM +0200, H. Peter Anvin wrote: > > > > Gcc combines floating point constants in constant expressions, even when > > > > cross compiling. > > > > > > Are you sure? Or only if the source and target use the same formats? > > > > Yes. read gcc/fold-const.c in the gcc source. They go into great pains > > to do that. > > > > -Andi > > > > Hmmmm. But gcc didn't do it in the kernel when it encountered some > real number constants, cast to an int.
tfp.c:
int f() { return (int) (1.02 * 2.0 - 3.121232); }
% gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/specs gcc version 2.7.2.3 % gcc -O2 -S tfp
tfp.s:
.file "tfp.c" .version "01.01" gcc2_compiled.: .text .align 4 .globl f .type f,@function f: pushl %ebp movl %esp,%ebp movl $-1,%eax <------------------------ leave ret .Lfe1: .size f,.Lfe1-f .ident "GCC: (GNU) 2.7.2.3"
-Andi
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html
| |