This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
floating-point constant bug
- To: "'egcs-bugs at egcs dot cygnus dot com'" <egcs-bugs at egcs dot cygnus dot com>
- Subject: floating-point constant bug
- From: Simon Marlow <simonmar at microsoft dot com>
- Date: Fri, 9 Apr 1999 05:54:44 -0700
Egcs bugs folks,
The following code, when optimised, leaves behind an unreferenced double
constant in read-only data space:
static inline void
assign_dbl(int dest[], double src)
{
*(double *)dest = src;
}
int i[2];
void f(void)
{
assign_dbl(i,2.0);
}
egcs-1.1.2 with -O gives (look at the lines marked with (****)):
.file "test1.c"
.version "01.01"
gcc2_compiled.:
.section .rodata
.align 8
.LC0: (****)
.long 0x0,0x40000000 (****)
.text
.align 4
.globl f
.type f,@function
f:
pushl %ebp
movl %esp,%ebp
movl $0,i
movl $1073741824,i+4
movl %ebp,%esp
popl %ebp
ret
.Lfe1:
.size f,.Lfe1-f
.comm i,8,4
.ident "GCC: (GNU) egcs-2.91.66 19990314 (egcs-1.1.2 release)"
Cheers,
Simon