This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

floating-point constant bug


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]